/* ============================================================
   BLOG.CSS — CodeAdventure Blog
   Redesigned with editorial depth, glassmorphism, and neon highlights
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@400;500;600;700&family=Outfit:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;700&display=swap');

:root {
    --neon-purple: #7f5af0;
    --neon-blue: #00d4ff;
    --neon-pink: #ff0077;
    --neon-green: #00ff88;
    --neon-gold: #ffd700;
    --bg-deep: #08080f;
    --bg-surface: rgba(12, 13, 28, 0.88);
    --bg-card: rgba(18, 19, 44, 0.84);
    --font-display: 'Fredoka', sans-serif;
    --font-body: 'Outfit', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    margin: 0;
    background: radial-gradient(circle at 12% 12%, rgba(127, 90, 240, 0.16), transparent 18%),
        radial-gradient(circle at 88% 14%, rgba(0, 212, 255, 0.16), transparent 16%),
        linear-gradient(180deg, #05050c 0%, #090911 38%, #090911 100%);
    color: #edf0ff;
    font-family: var(--font-body);
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.08), transparent 25%),
        radial-gradient(circle at 80% 70%, rgba(255, 255, 255, 0.04), transparent 15%),
        linear-gradient(90deg, rgba(255, 255, 255, 0.02), transparent 60%, rgba(255, 255, 255, 0.02));
    opacity: 0.45;
    mix-blend-mode: screen;
    z-index: -1;
}

/* --- DEBUG VISUAL: Sidebar y widgets en todos los tamaños --- */
.sidebar {
    width: 300px;
    min-width: 300px;
    max-width: 300px;
    flex: 0 0 300px;
    padding: 32px 0 40px;
    background: transparent !important;
    max-height: none;
    height: auto;
    overflow: visible;
    overflow-x: visible;
    overflow-y: visible;
    margin-top: 0;
    border: none;
    box-shadow: none;
}

.sidebar>* {
    margin-top: 8px;
}

/* --- COLORES SÓLIDOS Y VIVOS PARA CADA CONTENEDOR (PRIORIDAD AL FINAL) --- */
/* (Unificado en la regla principal de .sidebar) */

.sidebar-widget {
    background: rgba(255, 255, 255, 0.03); /* Fondo casi invisible */
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);           /* Mantiene el efecto de desenfoque */
    border: 1px solid rgba(255, 255, 255, 0.1);
    /* ... resto del código ... */
}

.cta-sidebar {
    /* Para el CTA, podemos usar un degradado sutil con tus colores neon 
       pero con mucha transparencia para que no se vea oscuro */
    background: linear-gradient(
        135deg, 
        rgba(127, 90, 240, 0.1), 
        rgba(0, 212, 255, 0.05)
    );
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(127, 90, 240, 0.3);
}

.sidebar-widget::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 24px;
    padding: 2px; /* Grosor del borde */
    background: linear-gradient(135deg, var(--neon-purple), transparent);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0.5;
    pointer-events: none;
}


/* ── Layout ──────────────────────────────────────────────── */
.blog-layout {
    position: relative;
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 34px;
    width: 100%;
    max-width: 1340px;
    margin: 0 auto;
    padding: 108px 24px 56px;
    box-sizing: border-box;
    overflow-x: hidden;
    z-index: 1;
    background: none;
}

.blog-layout::before {
    content: '';
    position: absolute;
    top: 12%;
    right: -120px;
    width: 420px;
    height: 420px;
    background: radial-gradient(circle, rgba(0, 212, 255, 0.16), transparent 52%);
    filter: blur(72px);
    pointer-events: none;
}

.blog-layout::after {
    content: '';
    position: absolute;
    left: -120px;
    bottom: -40px;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(127, 90, 240, 0.14), transparent 48%);
    filter: blur(88px);
    pointer-events: none;
}

/* ── Sidebar ─────────────────────────────────────────────── */
/* (Regla unificada arriba) */

.sidebar>.sidebar-widget,
.sidebar>.cta-sidebar {
    position: relative;
    z-index: 1;
}

/* ── Main Content ────────────────────────────────────────── */
.blog-content {
    flex: 1 1 0;
    min-width: 0;
    max-width: 100%;
    padding: 18px 0 0;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 30px;
    overflow-x: hidden;
    overflow: visible;
    height: auto;
    max-height: none;
}

/* ── Blog Hero ───────────────────────────────────────────── */
.blog-hero {
    position: relative;
    background: linear-gradient(180deg, rgba(12, 9, 33, 0.96), rgba(10, 14, 38, 0.96));
    padding: 58px 42px 54px;
    text-align: center;
    border-radius: 28px;
    margin-bottom: 20px;
    border: 1px solid rgba(127, 90, 240, 0.24);
    overflow: hidden;
    box-shadow: 0 22px 65px rgba(0, 0, 0, 0.28);
}

.blog-hero::before {
    content: '';
    position: absolute;
    top: -22px;
    right: -24px;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    background: rgba(0, 212, 255, 0.14);
    filter: blur(22px);
}

.blog-hero::after {
    content: '';
    position: absolute;
    left: 18%;
    bottom: -48px;
    width: 284px;
    height: 284px;
    border-radius: 50%;
    background: rgba(127, 90, 240, 0.16);
    filter: blur(24px);
}

.blog-hero h1 {
    font-family: var(--font-display);
    font-size: clamp(2rem, 4vw, 3.5rem);
    color: #fff;
    margin: 0 auto 16px;
    line-height: 1.05;
    max-width: 860px;
    letter-spacing: -0.02em;
    position: relative;
    z-index: 1;
}

.blog-hero h1 span {
    background: linear-gradient(135deg, var(--neon-purple), var(--neon-blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.blog-hero p {
    color: rgba(255, 255, 255, 0.72);
    max-width: 720px;
    margin: 0 auto;
    font-size: 1rem;
    line-height: 1.85;
    letter-spacing: 0.01em;
    position: relative;
    z-index: 1;
}

/* ── Posts Grid ──────────────────────────────────────────── */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 24px;
    width: 100%;
    box-sizing: border-box;
}

/* ── Post Card ───────────────────────────────────────────── */
.post-card {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 26px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.28s ease, box-shadow 0.28s ease, border-color 0.28s ease;
    box-sizing: border-box;
    position: relative;
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.24);
}

.post-card::before {
    content: '';
    position: absolute;
    top: -32px;
    right: -32px;
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0, 212, 255, 0.14), transparent 52%);
    filter: blur(18px);
    pointer-events: none;
}

.post-card:hover {
    transform: translateY(-6px);
    border-color: rgba(127, 90, 240, 0.28);
    box-shadow: 0 28px 60px rgba(0, 0, 0, 0.32);
}

.post-card-body {
    padding: 32px 34px;
    flex: 1;
    position: relative;
    z-index: 1;
    display: grid;
    gap: 18px;
}

/* ── Post Tags / Badges ──────────────────────────────────── */
.post-tag,
.featured-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    white-space: nowrap;
}

.post-tag {
    background: rgba(0, 212, 255, 0.12);
    color: var(--neon-blue);
    border: 1px solid rgba(0, 212, 255, 0.22);
}

.featured-badge {
    background: rgba(255, 215, 0, 0.13);
    color: var(--neon-gold);
    border: 1px solid rgba(255, 215, 0, 0.22);
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.34);
}

/* ── Post Title ──────────────────────────────────────────── */
.post-card h2 {
    font-family: var(--font-display);
    font-size: clamp(1.25rem, 2vw, 1.6rem);
    color: #fff;
    margin: 0 0 14px;
    line-height: 1.3;
    font-weight: 700;
}

.post-card h2 a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease;
}

.post-card h2 a:hover {
    color: var(--neon-blue);
}

/* ── Excerpt ─────────────────────────────────────────────── */
.post-card .excerpt {
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.95rem;
    line-height: 1.85;
    margin: 0 0 20px;
}

/* ── Post Meta ───────────────────────────────────────────── */
.post-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.46);
    margin-bottom: 12px;
    font-family: var(--font-mono);
    width: 100%;
}

/* ── Read More ───────────────────────────────────────────── */
.read-more {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--neon-purple);
    font-size: 0.9rem;
    font-weight: 800;
    text-decoration: none;
    transition: color 0.25s ease, transform 0.25s ease;
    letter-spacing: 0.02em;
    margin-top: 8px;
    width: fit-content;
}

.read-more::after {
    content: '';
    display: inline-block;
    width: 18px;
    height: 2px;
    background: currentColor;
    transform: translateX(-4px);
    transition: transform 0.25s ease;
}

.read-more:hover {
    color: var(--neon-blue);
}

.read-more:hover::after {
    transform: translateX(4px);
}

/* ── Sidebar Widgets ─────────────────────────────────────── */
.sidebar-widget {
    background: var(--bg-surface);
    border: 1px solid rgba(0, 255, 8, 0.06);
    border-radius: 24px;
    padding: 24px 22px;
    margin-bottom: 22px;
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.18);
}

.sidebar-widget h3 {
    font-family: var(--font-display);
    color: var(--neon-blue);
    font-size: 0.98rem;
    margin: 0 0 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(0, 212, 255, 0.14);
    letter-spacing: 0.04em;
    text-shadow: 0 0 10px rgba(0, 212, 255, 0.18);
}

.sidebar-widget ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-widget ul li {
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-widget ul li:last-child {
    border-bottom: none;
}

.sidebar-widget ul li a {
    color: rgba(255, 255, 255, 0.76);
    text-decoration: none;
    font-size: 0.92rem;
    transition: color 0.2s ease;
    display: block;
}

.sidebar-widget ul li a:hover {
    color: var(--neon-blue);
}

/* ── Category Chips ──────────────────────────────────────── */
.category-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(127, 90, 240, 0.16);
    color: rgba(255, 255, 255, 0.88);
    border: 1px solid rgba(127, 90, 240, 0.28);
    border-radius: 999px;
    padding: 8px 16px;
    font-size: 0.82rem;
    font-weight: 700;
    margin: 6px 6px 6px 0;
    transition: all 0.25s ease;
    text-decoration: none;
}

.category-chip:hover {
    background: linear-gradient(135deg, rgba(127, 90, 240, 0.28), rgba(0, 212, 255, 0.18));
    border-color: rgba(0, 212, 255, 0.55);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 16px 30px rgba(0, 212, 255, 0.12);
}

/* ── CTA Sidebar ─────────────────────────────────────────── */
.cta-sidebar {
    position: relative;
    background: linear-gradient(135deg, rgba(14, 10, 40, 0.98), rgba(8, 12, 33, 0.98));
    border: 1px solid rgba(127, 90, 240, 0.32);
    border-radius: 24px;
    padding: 32px 18px 32px 18px;
    text-align: center;
    overflow: hidden;
    box-shadow: 0 20px 48px rgba(0, 0, 0, 0.2);
    min-width: 0;
    max-width: 100%;
    height: auto;
    max-height: none;
    overflow: visible;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.cta-sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--neon-purple), transparent);
}

.cta-sidebar::after {
    content: '';
    position: absolute;
    bottom: -42px;
    right: -42px;
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    filter: blur(16px);
}

.cta-sidebar h3,
.cta-sidebar p,
.cta-sidebar a {
    white-space: normal;
    word-break: break-word;
    min-width: 0;
}

.cta-sidebar h3 {
    font-family: var(--font-display);
    color: #fff;
    margin: 0 0 12px;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.3;
}

.cta-sidebar p {
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.95rem;
    margin-bottom: 20px;
    line-height: 1.75;
}

.cta-sidebar a {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    background: linear-gradient(135deg, var(--neon-purple), var(--neon-blue));
    color: #fff;
    border-radius: 999px;
    text-decoration: none;
    font-weight: 800;
    font-size: 0.92rem;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    box-shadow: 0 10px 28px rgba(127, 90, 240, 0.24);
    box-sizing: border-box;
    width: auto;
    min-width: 120px;
    max-width: 100%;
    margin: 0 auto;
}

/* --- Espaciado visual CTA Sidebar y alineación superior --- */


@media (max-width: 1024px) {
    .sidebar {
        margin-top: 48px;
    }
}

/* --- FIX: Sidebar y CTA Sidebar altura auto --- */
/* (Unificado en la regla principal de .sidebar) */

.cta-sidebar {
    min-height: unset;
    height: auto;
}

@media (max-width: 600px) {
    .cta-sidebar {
        padding: 18px 6px;
        min-height: 120px;
    }

    .cta-sidebar a {
        max-width: 100%;
        font-size: 1rem;
        padding: 12px 0;
    }

    /* --- Eliminar espacio superior extra en sidebar móvil --- */
    .sidebar {
        margin-top: 0;
        padding-top: 0;
    }

    .sidebar> :first-child {
        margin-top: 0;
    }
}

/* --- DEBUG GLOBAL: Colores para toda la página en móvil --- */
@media (max-width: 600px) {
    /* Colores debug eliminados */
}

/* ── Responsive ──────────────────────────────────────────── */
@media (min-width: 1025px) {
    .sidebar {
        position: static;
        top: auto;
        max-height: none;
        overflow: visible;
        overflow-x: visible;
        overflow-y: visible;
        padding-right: 20px;
    }

    .posts-grid {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 28px;
    }
}

@media (max-width: 600px) {
    .sidebar {
        margin-top: 0;
        padding-top: 0;
    }
    .sidebar> :first-child {
        margin-top: 0;
    }
}


@media (max-width: 768px) {
    .blog-hero {
        padding: 38px 24px 34px;
    }

    .post-card-body {
        padding: 24px;
    }
}

@media (max-width: 480px) {
    .blog-layout {
        padding: 0 12px 30px;
    }

    .post-meta {
        gap: 10px;
    }

    .blog-hero h1 {
        font-size: 1.7rem;
    }

    .post-card {
        border-radius: 22px;
    }
}

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms;
        transition-duration: 0.01ms;
    }
}

/* --- Eliminar scroll de blog-layout y blog-content --- */
.blog-layout,
.blog-content {
    overflow: visible;
    overflow-x: visible;
    overflow-y: visible;
    width: 100%;
    max-width: 100%;
    height: auto;
    max-height: none;
}

/* --- Eliminar scroll de sidebar --- */
/* (Unificado en la regla principal de .sidebar) */