:root {
    --bg-dark: #0a0a0c;
    --bg-card: #141417;
    --bg-card-hover: #1c1c21;
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --accent: #3b82f6;
    /* Blue */
    --accent-glow: rgba(59, 130, 246, 0.4);
    --border: rgba(255, 255, 255, 0.08);
    --gradient-accent: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);

    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-body);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Typography */
h1,
h2,
h3,
h4 {
    font-family: var(--font-heading);
    font-weight: 700;
    letter-spacing: -0.02em;
}

a {
    color: var(--text-main);
    text-decoration: none;
    transition: color 0.2s ease;
}

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

.mt-4 {
    margin-top: 2rem;
}

/* Navbar */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(10, 10, 12, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}

.nav-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.03em;
}

.logo-accent {
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-links {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.nav-links a {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
}

.nav-links a:hover {
    color: var(--text-main);
}

.subscribe-btn {
    background: var(--gradient-accent);
    color: white;
    border: none;
    padding: 0.5rem 1.2rem;
    border-radius: 99px;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    box-shadow: 0 4px 14px var(--accent-glow);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.subscribe-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--accent-glow);
}

/* Ads Placeholders & Containers */
.ad-container {
    width: 100%;
    display: flex;
    justify-content: center;
    margin: 1rem 0;
    overflow: hidden;
    /* Prevent ads from breaking layout */
}

.ad-top {
    margin: 0.5rem 0;
}

.ad-sidebar {
    margin-top: 1rem;
}

/* Base structural dimensions to prevent Cumulative Layout Shift (CLS) */
.ad-top ins {
    min-width: 100%;
    min-height: 90px;
}

.ad-article ins {
    min-width: 100%;
    min-height: 150px;
}

.ad-vertical ins {
    min-width: 100%;
    min-height: 250px;
}

/* 
 * The standard classes below limit dimensions.
 * For AdSense responsive ads to work optimally, they need flexible width. 
 * We keep these wrappers to ensure the layout doesn't break.
 */
.ad-top {
    width: 100%;
    max-width: 728px;
    margin: 0 auto; /* Eliminado el margen vertical inicial */
}

.ad-article {
    width: 100%;
    height: auto;
}

/* Sidebar Ad */
.ad-vertical {
    width: 100%;
    min-height: 250px;
}

/* Layout */
.main-layout {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 3rem;
    align-items: start;
}

.section-title {
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
    position: relative;
    display: inline-block;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    width: 40px;
    height: 3px;
    background: var(--gradient-accent);
    border-radius: 2px;
}

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    transition: transform 0.3s ease, border-color 0.3s ease;
    display: flex;
    flex-direction: column;
}

.card:hover {
    transform: translateY(-4px);
    border-color: rgba(255, 255, 255, 0.15);
}

.card-image {
    width: 100%;
    height: 180px;
    object-fit: cover;
    background: var(--bg-dark);
}

.card-content {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.tag {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 0.5rem;
    display: inline-block;
}

.card-title {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
    line-height: 1.4;
}

.card-excerpt {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex-grow: 1;
}

.card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Featured Card */
.featured-card {
    background: var(--bg-card);
    border-radius: 24px;
    overflow: hidden;
    border: 1px solid var(--border);
    position: relative;
    transition: transform 0.3s ease, border-color 0.3s ease;
}

.featured-card:hover {
    transform: translateY(-4px);
    border-color: rgba(255, 255, 255, 0.15);
}

.featured-image {
    width: 100%;
    height: 400px;
    object-fit: cover;
}

.featured-content {
    padding: 2.5rem;
    background: linear-gradient(to top, var(--bg-card) 0%, rgba(20, 20, 23, 0.8) 100%);
    position: absolute;
    bottom: 0;
    width: 100%;
    backdrop-filter: blur(10px);
}

.featured-title {
    font-size: 2.5rem;
    margin: 0.5rem 0 1rem;
    line-height: 1.2;
}

/* Trending Grid */
.trending-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

/* Sidebar */
.sidebar-sticky {
    position: sticky;
    top: 100px;
}

.sidebar-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    font-size: 1.2rem;
    color: var(--text-main);
}

/* Vertical Feed */
.vertical-feed {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.feed-item {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.feed-item:hover {
    background: var(--bg-card-hover);
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateX(4px);
}

.feed-item-img {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
}

.feed-item-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.feed-item-title {
    font-size: 1rem;
    margin-bottom: 0.25rem;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.feed-item-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Footer */
.footer {
    margin-top: 5rem;
    border-top: 1px solid var(--border);
    padding: 3rem 1.5rem;
    background: var(--bg-card);
}

.footer-content {
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    text-align: center;
}

.footer-logo {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 800;
}

.footer p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.footer-links {
    display: flex;
    gap: 1.5rem;
}

.footer-links a {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 1024px) {
    .main-layout {
        grid-template-columns: 1fr;
    }

    .sidebar-sticky {
        position: static;
    }

    .featured-title {
        font-size: 2rem;
    }
}

@media (max-width: 768px) {
    .nav-links {
        display: none;
    }

    .featured-title {
        font-size: 1.5rem;
    }

    .featured-content {
        padding: 1.5rem;
    }

    .featured-image {
        height: 300px;
    }

    /* Mobile Ad Optimizations */
    .ad-container {
        margin: 0.25rem 0;
    }

    .ad-article ins,
    .ad-vertical ins {
        min-height: 100px;
    }

    .ad-placeholder {
        height: 100px !important;
    }
}

/* Static Pages & Article Layout */
.page-layout,
.article-layout {
    margin-top: 1rem; /* Reducido de 3rem */
}

.page-title {
    font-size: 2.5rem;
    margin-bottom: 2rem;
    color: var(--text-main);
}

.legal-content {
    background: var(--bg-card);
    padding: 3rem;
    border-radius: 16px;
    border: 1px solid var(--border);
}

.legal-content h2 {
    margin-top: 2rem;
    margin-bottom: 1rem;
    font-size: 1.5rem;
    color: #fff;
}

.legal-content p,
.legal-content ul {
    margin-bottom: 1.5rem;
    color: var(--text-muted);
    font-size: 1.05rem;
    line-height: 1.8;
}

.legal-content ul {
    padding-left: 2rem;
}

/* Contact Form */
.contact-form-container {
    background: var(--bg-card);
    padding: 3rem;
    border-radius: 16px;
    border: 1px solid var(--border);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-main);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 1rem;
    background: var(--bg-dark);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 1rem;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent);
}

/* Article Page */
.article-header {
    margin-bottom: 2rem;
}

.article-meta-info {
    display: flex;
    gap: 1rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 1rem;
}

.article-hero-img {
    width: 100%;
    border-radius: 16px;
    margin-bottom: 2.5rem;
    object-fit: cover;
    height: 400px;
}

.article-body p {
    font-size: 1.15rem;
    line-height: 1.8;
    color: var(--text-main);
    margin-bottom: 1.5rem;
}

.article-body h2 {
    font-size: 1.8rem;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
}

/* Newsletter Modal Overlay */
.newsletter-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    z-index: 99999;
    display: none;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.newsletter-modal-overlay.active {
    display: flex;
    opacity: 1;
}

.newsletter-modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 2.5rem;
    width: 90%;
    max-width: 500px;
    position: relative;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    transform: translateY(20px);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-align: center;
}

.newsletter-modal-overlay.active .newsletter-modal {
    transform: translateY(0);
}

.close-modal-btn {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.2s ease;
}

.close-modal-btn:hover {
    color: var(--text-main);
}

.newsletter-modal h3 {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.newsletter-modal p {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 2rem;
}

/* Breadcrumbs */
.breadcrumbs a:hover {
    color: var(--accent);
    text-decoration: underline;
}

/* Category Header */
.category-header {
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    transition: transform 0.3s ease;
}

.category-header:hover {
    transform: translateY(-2px);
}

/* Search Container mobile fix */
@media (max-width: 768px) {
    .search-container {
        display: none; /* Hide on mobile navbar */
    }
}

/* Author Profile */
.author-profile {
    box-shadow: 0 8px 30px rgba(0,0,0,0.3);
}

.internal-linking-box li a:hover {
    text-decoration: underline;
}

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