/* Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
p[class*="termly-styles"] {
    font-size: 10px;
}
body {
    font-family: Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
}

body.dark {
    color: #f3f4f6;
    background-color: #111827;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

a {
    color: #0366d6;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.dark a {
    color: #60a5fa;
}

.dark a:hover {
    text-decoration: underline;
}

/* Header */
header {
    background-color: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: 15px 0;
}

.dark header {
    background-color: #1f2937;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.logo {
    padding: 10px 0;
}

.logo img {
    max-height: 50px;
}

/* Logo color handling for light/dark mode */
html:not(.dark) .site-logo {
    filter: invert(1) grayscale(1);
    transition: filter 0.3s ease;
}

/* Ensure logo remains visible during transition */
.site-logo {
    transition: filter 0.3s ease;
}

/* Main Content */
main {
    padding: 30px 0;
}

/* Homepage */
.homepage {
    margin-bottom: 30px;
}

.dark .homepage {
    background-color: #111827;
}

.hero-section {
    background-color: #f0f0f0;
    padding: 30px;
    text-align: center;
    margin-bottom: 30px;
}

.hero-section h1 {
    font-size: 2.5rem;
    margin-bottom: 15px;
}

.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    grid-gap: 20px;
    margin-bottom: 30px;
}

.article-card {
    background-color: #fff;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: transform 0.3s;
}

.article-card:hover {
    transform: translateY(-5px);
}

.article-image {
    height: 200px;
    overflow: hidden;
}

.article-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.article-content {
    padding: 15px;
}

.article-content h3 {
    margin-bottom: 10px;
}

.article-meta {
    color: #666;
    font-size: 0.9rem;
    margin-top: 15px;
    display: flex;
    justify-content: space-between;
}

.articles-list .article-item {
    padding: 15px;
    border-bottom: 1px solid #eee;
}

.articles-list .article-item:last-child {
    border-bottom: none;
}

.featured-articles,
.recent-articles {
    margin-bottom: 30px;
}

.featured-articles h2,
.recent-articles h2 {
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

/* Article Page */
.article-page {
    display: grid;
    grid-template-columns: 2fr 1fr;
    grid-gap: 30px;
}

.main-article {
    background-color: #fff;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    padding: 30px;
}

.article-header {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.article-header h1 {
    font-size: 2.5rem;
    margin-bottom: 15px;
}

.article-meta {
    color: #666;
    font-size: 0.9rem;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.featured-image {
    margin-bottom: 20px;
}

.featured-image img {
    width: 100%;
    border-radius: 5px;
}

.article-content {
    font-size: 1.1rem;
    line-height: 1.8;
    margin-bottom: 30px;
}

.article-footer {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.tag {
    background-color: #f0f0f0;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 0.9rem;
}

/* Sidebar */
.sidebar {
    align-self: start;
}

.sidebar > div {
    background-color: #fff;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    padding: 20px;
}

.related-articles h3 {
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.related-articles ul {
    list-style: none;
}

.related-articles li {
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.related-articles li:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

/* Ad Containers */
.ad-container {
    margin: 30px 0;
    padding: 15px;
    background-color: #f9f9f9;
    border-radius: 5px;
    text-align: center;
}

/* Footer */
footer {
    background-color: #fff;
    padding: 20px 0;
    margin-top: 30px;
    box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.1);
}

.dark footer {
    background-color: #1f2937;
    box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.3);
}

.footer .row {
    display: flex;
    justify-content: space-between;
}

/* Responsive */
@media (max-width: 768px) {
    .article-page {
        grid-template-columns: 1fr;
    }
    
    .articles-grid {
        grid-template-columns: 1fr;
    }
    
    .footer .row {
        flex-direction: column;
        text-align: center;
    }
    
    .footer .text-right {
        margin-top: 15px;
        text-align: center;
    }
}

/* News Top Stories Layout - Article Styles */
.news-topstories-layout .article-image img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 8px;
}

.news-topstories-layout .main-story .article-image img {
    height: 400px;
}

.news-topstories-layout .secondary-stories .article-thumbnail img {
    width: 120px;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
}

.news-topstories-layout .news-grid {
    gap: 20px;
}

.news-topstories-layout .news-item .article-card {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

.news-topstories-layout .news-item .article-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* Fix image aspect ratios for RSOC */
.article-image {
    position: relative;
    overflow: hidden;
    background: #f5f5f5;
}

.article-image img {
    display: block;
    width: 100%;
    height: auto;
}

/* Fallback for missing images */
.article-card:not(:has(.article-image)) {
    padding-top: 20px;
}

.article-card:not(:has(.article-image)) .article-content {
    padding-top: 0;
}

/* Better typography for RSOC articles */
.news-topstories-layout h3 {
    font-size: 1.5rem;
    line-height: 1.3;
    margin-bottom: 10px;
}

.news-topstories-layout h4 {
    font-size: 1.1rem;
    line-height: 1.4;
    margin-bottom: 8px;
}

.news-topstories-layout .article-summary {
    color: #666;
    line-height: 1.6;
    margin-bottom: 12px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

/* Trending sidebar improvements */
.trending-section {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 8px;
}

.trending-section h3 {
    font-size: 1.2rem;
    margin-bottom: 15px;
    border-bottom: 2px solid #333;
    padding-bottom: 8px;
}