/* Banner de aviso de cookies */
.cookie-banner {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    background: #222;
    color: #fff;
    padding: 1rem 2rem;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    font-size: 1rem;
    box-shadow: 0 -2px 12px rgba(0,0,0,0.12);
    transition: transform 0.3s;
}
.cookie-banner button {
    background: #fbc02d;
    color: #222;
    border: none;
    border-radius: 5px;
    padding: 0.5em 1.2em;
    font-weight: bold;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.2s;
}
.cookie-banner button:hover {
    background: #ffd600;
}
/* Header sticky en todos los artículos */
.main-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: #fff;
    box-shadow: 0 2px 8px rgba(44,62,80,0.06);
    transition: box-shadow 0.2s;
}
/* ===== Mobile-first base adjustments ===== */
html {
    scroll-behavior: smooth;
}
img { max-width: 100%; height: auto; display: block; }

/* Refuerzo para que todo el contenido del artículo nunca se salga en móvil */
.article-container,
.reading-friendly,
.container {
    box-sizing: border-box;
    width: 100%;
    word-break: break-word;
    overflow-wrap: break-word;
    padding-left: 8px;
    padding-right: 8px;
}

.article-container img,
.article-container iframe,
.article-container .adsbygoogle {
    max-width: 100%;
    width: 100%;
    height: auto !important;
    display: block;
    box-sizing: border-box;
}
.container { padding: 0 16px; }

/* Article sections should not hide under fixed headers when linked */
.reading-friendly section[id] { scroll-margin-top: 96px; }

/* Layouts (mobile-first) */
.layout-grid { display: grid; gap: 16px; }
.main-content, .sidebar { width: 100%; }

/* Article layout: stack on mobile */
.article-layout { display: flex; flex-direction: column; width: 100%; gap: 24px; box-sizing: border-box; }
.article-layout.left { grid-template-columns: 1fr; }
.sidebar .ad-space { position: static; }

/* Typography (mobile-first) */
.reading-friendly h1 { font-size: 1.75rem; line-height: 1.3; }
.reading-friendly h2 { font-size: 1.25rem; }
.reading-friendly h3 { font-size: 1.05rem; }
.reading-friendly p, .reading-friendly li { font-size: 1rem; }

/* Related grid: single column on mobile */
.related-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }

/* Breadcrumb spacing */
.breadcrumb { font-size: .95rem; margin: .5rem 0 1rem; }

/* Callouts and quotes */
.callout { background: #f9fbff; border-left: 4px solid #3f51b5; padding: 12px 14px; border-radius: 6px; }
.quote { font-style: italic; color: #455a64; border-left: 3px solid #cfd8dc; padding-left: 12px; }

/* Conclusion block */
.conclusion-block { background: #f7f9ff; border: 1px solid #e2e8f0; border-radius: 10px; padding: 16px 18px; }
.conclusion-block .key-takeaways { display: grid; grid-template-columns: 1fr; gap: 10px; margin-top: 10px; }
.conclusion-block .key-item { background: #ffffff; border: 1px solid #eef2f7; border-radius: 8px; padding: 10px 12px; }
.conclusion-note { color: #546e7a; font-size: .95rem; }

/* Media block */
.article-media { margin: 1rem 0; }
.article-media img { border-radius: 8px; }
.article-media figcaption { font-size: .9rem; color: #78909c; margin-top: 6px; }

/* ===== Enhancements for larger screens ===== */
@media (min-width: 768px) {
    .container { padding: 0 24px; }
    .reading-friendly h1 { font-size: 2rem; }
    .reading-friendly h2 { font-size: 1.4rem; }
    .reading-friendly h3 { font-size: 1.15rem; }
    .layout-grid { grid-template-columns: 1fr 320px; }
    .sticky-ad { position: sticky; top: 16px; }
    .article-layout { display: grid; grid-template-columns: 1fr 320px; gap: 24px; align-items: flex-start; }
    .article-layout.left { grid-template-columns: 320px 1fr; }
    .conclusion-block .key-takeaways { grid-template-columns: repeat(2, minmax(0,1fr)); }
    /* En escritorio: activar sticky y 2 columnas en relacionados */
    .sidebar .ad-space { position: sticky; top: 16px; }
    .related-grid { grid-template-columns: repeat(2, 1fr); }
}
/* ========== Artículos: layout y legibilidad (genérico) ========== */
.article-container { padding: 2rem 0; max-width: 1200px; }
/* En móvil, el artículo debe ir arriba y los anuncios debajo */
.article-layout { display: grid; grid-template-columns: 1fr; gap: 16px; }
.article-layout.left { grid-template-columns: 1fr; }
.reading-friendly p { line-height: 1.8; margin: 0.8rem 0; }
.reading-friendly ul, .reading-friendly ol { line-height: 1.8; }
.article-figure { margin: 1rem 0; }

/* Índice (TOC) */
.toc { background: #f7f9fc; border: 1px solid #e6ecf5; padding: 12px 16px; border-radius: 8px; }
.toc h3 { margin: 0 0 8px; font-size: 1rem; }
.toc ul { list-style: none; padding: 0; margin: 0; }
.toc li { margin: 6px 0; }

/* Migas de pan */
.breadcrumb { font-size: .9rem; color: #607d8b; margin: .5rem 0 1rem; }
.breadcrumb a { color: inherit; }

/* Sidebar de anuncios en artículos (base móvil: no sticky) */
.sidebar .ad-space { position: static; }

/* Grid de relacionados en artículos (base móvil: 1 columna) */
.related-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }

/* Bloques de anuncios genéricos */
.ad-block { display: block; }
.ad-margin-bottom { margin-bottom: 24px; }

/* Tipografías y lectura en artículos */
.reading-friendly h1 { font-size: 2rem; line-height: 1.25; margin: 0 0 0.75rem; }
.reading-friendly h2 { font-size: 1.4rem; margin: 1.25rem 0 0.5rem; }
.reading-friendly h3 { font-size: 1.15rem; margin: 1rem 0 0.5rem; }
.reading-friendly .meta { color: #607d8b; font-size: .95rem; }
.reading-friendly .lead { font-size: 1.1rem; color: #37474f; }

/* Bloques destacados y citas */
.callout { background: #f9fbff; border-left: 4px solid #3f51b5; padding: 12px 14px; border-radius: 6px; }
.quote { font-style: italic; color: #455a64; border-left: 3px solid #cfd8dc; padding-left: 12px; }

/* Conclusión destacada */
.conclusion-block { background: #f7f9ff; border: 1px solid #e2e8f0; border-radius: 10px; padding: 16px 18px; }
.conclusion-block .key-takeaways { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; margin-top: 10px; }
.conclusion-block .key-item { background: #ffffff; border: 1px solid #eef2f7; border-radius: 8px; padding: 10px 12px; }
.conclusion-note { color: #546e7a; font-size: .95rem; }

/* Media en artículo */
.article-media { margin: 1rem 0; }
.article-media img { width: 100%; height: auto; border-radius: 8px; }
.article-media figcaption { font-size: .9rem; color: #78909c; margin-top: 6px; }

/* Listas más aireadas */
.reading-friendly li { margin: 0.4rem 0; }
/* RESET & BASICS */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f4f7f6; /* Gris muy suave para no cansar la vista */
    overflow-x: hidden; /* Evita desbordes horizontales en móvil */
}

a { text-decoration: none; color: inherit; transition: 0.3s; }
ul { list-style: none; }

/* LAYOUT CONTAINER */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Evitar que el contenido se salga en móvil */
.reading-friendly, .article-container, .container {
    word-wrap: break-word;
    overflow-wrap: anywhere;
}

/* HEADER */
.main-header {
    background: #ffffff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    color: #2c3e50;
}
.logo span { color: #3498db; }

.main-header nav ul { display: flex; gap: 20px; justify-content: center; }
.main-header nav a {
    font-weight: 500;
    color: #555;
}
.main-header nav a:hover, .main-header nav a.active { color: #3498db; }

/* HERO SECTION */
.hero {
    background: linear-gradient(135deg, #2c3e50 0%, #3498db 100%);
    color: white;
    text-align: center;
    padding: 3rem 1rem;
    margin-bottom: 2rem;
}

.hero h1 { font-size: 2.5rem; margin-bottom: 0.5rem; }
.hero p { font-size: 1.2rem; opacity: 0.9; }

/* MAIN GRID LAYOUT */
.layout-grid {
    display: grid;
    grid-template-columns: 1fr 300px; /* Contenido flexible | Sidebar fijo 300px */
    gap: 30px;
    margin-bottom: 40px;
}

/* BLOG CARDS */
.blog-card {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    margin-bottom: 30px;
    transition: transform 0.2s;
    border: 1px solid #eee;
}

.blog-card:hover { transform: translateY(-3px); box-shadow: 0 5px 15px rgba(0,0,0,0.1); }

.card-image img {
    width: 100%;
    height: 250px;
    object-fit: cover; /* Asegura que las imágenes no se deformen */
}

.card-content { padding: 20px; }

.category {
    background: #e1f5fe;
    color: #0277bd;
    padding: 4px 8px;
    font-size: 0.8rem;
    border-radius: 4px;
    font-weight: bold;
    text-transform: uppercase;
}

.card-content h3 {
    margin: 10px 0;
    font-size: 1.6rem;
    color: #2c3e50;
}

.card-content h3 a:hover { color: #3498db; }
.card-content p { color: #666; margin-bottom: 15px; }
.read-more { color: #3498db; font-weight: bold; font-size: 0.9rem; }

/* SIDEBAR & ADS */
.sidebar { margin-top: 0; }

.widget {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid #eee;
}

.widget h3 {
    border-bottom: 2px solid #3498db;
    padding-bottom: 10px;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.ad-label {
    font-size: 0.7rem;
    text-align: center;
    color: #ccc;
    text-transform: uppercase;
    margin-bottom: 5px;
}

.category-list li {
    border-bottom: 1px solid #f0f0f0;
    padding: 8px 0;
}
.category-list li:last-child { border: none; }
.category-list a:hover { color: #3498db; padding-left: 5px; }

/* FOOTER */
footer {
    background: #2c3e50;
    color: #ecf0f1;
    padding: 40px 0;
    margin-top: auto;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 20px;
}

.footer-section h4 { margin-bottom: 15px; color: #fff; }
.footer-section ul li { margin-bottom: 8px; }
.footer-section a { color: #bdc3c7; }
.footer-section a:hover { color: white; text-decoration: underline; }

/* RESPONSIVE (MÓVILES) */
@media (max-width: 768px) {
    .layout-grid {
        grid-template-columns: 1fr; /* Columna única en móviles */
    }
    
    .hero h1 { font-size: 2rem; }
    
    .main-header nav ul {
        flex-direction: column; /* Menú vertical si es necesario o añadir JS para hamburguesa */
        display: none; /* Simplificación para este ejemplo */
    }
    
    /* Mostrar menú básico en móvil */
    .main-header nav ul { display: flex; flex-direction: row; font-size: 0.8rem; gap:10px; }
}

/* ===== AdSense responsiveness and containment ===== */
.ad-space { overflow: hidden; }
.adsbygoogle { max-width: 100% !important; width: 100% !important; height: auto !important; display: block !important; }
.ad-block { display: block; }
.ad-margin-bottom { margin-bottom: 24px; }