/* ===== CSS Variables ===== */
:root {
    --brand: #c62828;
    --brand-light: #ef5350;
    --brand-dark: #8e0000;
    --accent: #f9a825;
    --bg: #fafafa;
    --surface: #ffffff;
    --border: #e8e8e8;
    --text: #1a1a1a;
    --text-secondary: #666;
    --text-muted: #999;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.04);
    --shadow-md: 0 4px 16px rgba(0,0,0,.06);
    --shadow-lg: 0 12px 40px rgba(0,0,0,.1);
    --shadow-xl: 0 20px 60px rgba(0,0,0,.12);
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-xl: 28px;
    --transition: .2s cubic-bezier(.4,0,.2,1);
}

/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 17px; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; scroll-behavior: smooth; }

body {
    font-family: 'Noto Sans Sinhala', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
    letter-spacing: -.01em;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select { font-family: inherit; }

::selection { background: var(--brand); color: #fff; }

/* ===== Typography ===== */
h1, h2, h3, h4, h5 { letter-spacing: -.02em; }
.font-heading { font-weight: 900; letter-spacing: -.03em; }

/* ===== Top Bar ===== */
.topbar {
    background: #111;
    color: rgba(255,255,255,.65);
    font-size: .7rem;
    font-weight: 500;
    letter-spacing: .02em;
}
.topbar-inner {
    max-width: 1240px;
    margin: 0 auto;
    padding: 6px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.topbar .live-dot { display: inline-block; width: 7px; height: 7px; background: #4caf50; border-radius: 50%; margin-right: 6px; animation: pulse 2s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .4; } }

/* ===== Header ===== */
.site-header {
    background: #fff;
    border-bottom: 1px solid #eee;
    position: sticky;
    top: 0;
    z-index: 100;
}
.header-inner {
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
    gap: 20px;
}
.logo { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.logo-mark {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--brand), var(--brand-dark));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 900;
    font-size: .85rem;
    letter-spacing: -.03em;
    box-shadow: 0 4px 12px rgba(198,40,40,.3);
}
.logo-text { line-height: 1.15; }
.logo-text .main { font-weight: 900; font-size: 1.1rem; color: #111; }
.logo-text .sub { font-size: .58rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; }
.logo-text .main span { color: var(--brand); }

.header-search { flex: 1; max-width: 380px; position: relative; }
.header-search input {
    width: 100%;
    padding: 10px 16px 10px 42px;
    border: 1.5px solid #e0e0e0;
    border-radius: 50px;
    font-size: .8rem;
    background: #f5f5f5;
    transition: var(--transition);
    outline: none;
}
.header-search input:focus { border-color: var(--brand); background: #fff; box-shadow: 0 0 0 4px rgba(198,40,40,.08); }
.header-search .search-icon { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: #aaa; font-size: .9rem; pointer-events: none; }

.header-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #f5f5f5;
    border: 1.5px solid #e0e0e0;
    padding: 9px 18px;
    border-radius: 50px;
    font-size: .78rem;
    font-weight: 700;
    color: #555;
    transition: var(--transition);
    white-space: nowrap;
}
.header-action:hover { background: #fff; border-color: var(--brand); color: var(--brand); }

/* ===== Category Nav ===== */
.cat-nav {
    background: #fff;
    border-bottom: 1px solid #f0f0f0;
}
.cat-nav-inner {
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    gap: 4px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.cat-nav-inner::-webkit-scrollbar { display: none; }
.cat-nav a {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 11px 18px;
    font-size: .78rem;
    font-weight: 600;
    color: #666;
    border-bottom: 2px solid transparent;
    transition: var(--transition);
    white-space: nowrap;
    flex-shrink: 0;
}
.cat-nav a:hover { color: #111; border-bottom-color: #ddd; }
.cat-nav a.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 700; }

/* ===== Main Content ===== */
.main-content { max-width: 1240px; margin: 0 auto; padding: 32px 20px; }

/* ===== Hero Section ===== */
.hero { margin-bottom: 36px; }
.hero-card {
    position: relative;
    border-radius: var(--radius-xl);
    overflow: hidden;
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    min-height: 420px;
    display: flex;
    align-items: flex-end;
    box-shadow: var(--shadow-lg);
}
.hero-card img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .6s cubic-bezier(.4,0,.2,1);
}
.hero-card:hover img { transform: scale(1.04); }
.hero-overlay {
    position: relative;
    z-index: 1;
    width: 100%;
    padding: 48px;
    background: linear-gradient(to top, rgba(0,0,0,.85) 0%, rgba(0,0,0,.35) 60%, transparent 100%);
}
.hero-overlay .badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--brand);
    color: #fff;
    font-size: .68rem;
    font-weight: 800;
    padding: 6px 14px;
    border-radius: 50px;
    margin-bottom: 14px;
    letter-spacing: .03em;
    text-transform: uppercase;
}
.hero-overlay .category-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(255,255,255,.15);
    backdrop-filter: blur(10px);
    color: rgba(255,255,255,.9);
    font-size: .7rem;
    font-weight: 600;
    padding: 5px 12px;
    border-radius: 50px;
    margin-left: 6px;
    vertical-align: middle;
}
.hero-overlay h1 {
    font-size: 2.6rem;
    font-weight: 900;
    color: #fff;
    line-height: 1.2;
    max-width: 750px;
    letter-spacing: -.03em;
}
.hero-overlay p {
    color: rgba(255,255,255,.7);
    margin-top: 8px;
    font-size: .95rem;
    line-height: 1.5;
    max-width: 600px;
}
@media (max-width: 768px) {
    .hero-card { min-height: 300px; border-radius: var(--radius-lg); }
    .hero-overlay { padding: 24px; }
    .hero-overlay h1 { font-size: 1.5rem; }
    .hero-overlay p { display: none; }
}

/* ===== Section Headers ===== */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}
.section-header h2 {
    font-size: 1.25rem;
    font-weight: 900;
    color: #111;
    display: flex;
    align-items: center;
    gap: 10px;
}
.section-header h2::after { content: ''; display: block; height: 3px; width: 48px; background: var(--brand); border-radius: 50px; }
.section-link {
    font-size: .75rem;
    font-weight: 700;
    color: var(--brand);
    transition: var(--transition);
}
.section-link:hover { opacity: .7; }

/* ===== Sri Lanka Grid ===== */
.sl-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; margin-bottom: 36px; }
.sl-card {
    background: #fff;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border);
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}
.sl-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.sl-card img { width: 100%; height: 160px; object-fit: cover; }
.sl-card-body { padding: 16px; }
.sl-card-body .meta { font-size: .68rem; color: var(--text-muted); font-weight: 600; margin-bottom: 6px; }
.sl-card-body .title { font-size: .92rem; font-weight: 800; line-height: 1.35; color: #111; }

/* ===== News Feed ===== */
.news-layout { display: grid; grid-template-columns: 1fr 320px; gap: 28px; align-items: start; }
@media (max-width: 900px) { .news-layout { grid-template-columns: 1fr; } }

.news-card {
    background: #fff;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border);
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
    display: flex;
    margin-bottom: 16px;
}
.news-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.news-card .thumb {
    width: 220px;
    min-height: 170px;
    flex-shrink: 0;
    object-fit: cover;
}
.news-card .body { padding: 20px; display: flex; flex-direction: column; justify-content: center; }
.news-card .meta-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    font-size: .68rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 8px;
}
.news-card .category-chip {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    background: #fff5f5;
    color: var(--brand);
    font-size: .65rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 50px;
    border: 1px solid #ffcdd2;
}
.news-card h3 {
    font-size: 1.08rem;
    font-weight: 800;
    line-height: 1.35;
    color: #111;
    margin-bottom: 6px;
}
.news-card .excerpt { font-size: .8rem; color: var(--text-secondary); line-height: 1.55; }
@media (max-width: 640px) {
    .news-card { flex-direction: column; }
    .news-card .thumb { width: 100%; min-height: 180px; }
}

/* ===== Sidebar ===== */
.sidebar { position: sticky; top: 88px; }
.sidebar-block {
    background: #fff;
    border-radius: var(--radius-xl);
    border: 1px solid var(--border);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}
.sidebar-block h3 {
    font-size: .95rem;
    font-weight: 900;
    color: #111;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.trending-item {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    border-top: 1px solid #f0f0f0;
    transition: var(--transition);
}
.trending-item:first-child { border-top: none; }
.trending-item:hover .trending-title { color: var(--brand); }
.trending-rank {
    font-size: 1.6rem;
    font-weight: 900;
    color: #e0e0e0;
    line-height: 1;
    width: 28px;
    flex-shrink: 0;
}
.trending-rank.top { color: var(--brand); }
.trending-info { min-width: 0; }
.trending-title { font-size: .82rem; font-weight: 700; line-height: 1.35; color: #333; }
.trending-meta { font-size: .65rem; color: var(--text-muted); font-weight: 600; margin-top: 3px; }

.category-cloud { display: flex; flex-wrap: wrap; gap: 6px; }
.category-cloud a {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: .7rem;
    font-weight: 700;
    color: #555;
    background: #f5f5f5;
    padding: 6px 12px;
    border-radius: 50px;
    border: 1px solid #eee;
    transition: var(--transition);
}
.category-cloud a:hover { background: #fff5f5; color: var(--brand); border-color: #ffcdd2; }
.category-cloud a .count { font-size: .6rem; color: var(--text-muted); }

/* ===== Article Page ===== */
.article-wrap { max-width: 760px; margin: 0 auto; }
.article-breadcrumbs {
    font-size: .72rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 20px;
}
.article-breadcrumbs a { color: var(--text-secondary); transition: var(--transition); }
.article-breadcrumbs a:hover { color: var(--brand); }
.article-breadcrumbs span { margin: 0 6px; color: #ccc; }

.article-box {
    background: #fff;
    border-radius: var(--radius-xl);
    border: 1px solid var(--border);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
.article-header { padding: 36px 40px 24px; }
@media (max-width: 640px) { .article-header { padding: 24px 20px 16px; } }
.article-header .meta-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    font-size: .72rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 16px;
}
.article-header .meta-bar .cat-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--brand);
    color: #fff;
    padding: 4px 12px;
    border-radius: 50px;
    font-size: .68rem;
    font-weight: 700;
}
.article-header h1 {
    font-size: 2.2rem;
    font-weight: 900;
    line-height: 1.3;
    color: #111;
    letter-spacing: -.03em;
}
@media (max-width: 640px) { .article-header h1 { font-size: 1.4rem; } }

.article-image {
    margin: 0 40px;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}
@media (max-width: 640px) { .article-image { margin: 0 20px; } }
.article-image img { width: 100%; }

.article-body { padding: 28px 40px 36px; }
@media (max-width: 640px) { .article-body { padding: 20px; } }

.article-body .prose { font-size: 1.02rem; color: #333; }
.article-body .prose h2 {
    font-size: 1.35rem;
    font-weight: 900;
    color: #111;
    margin: 2rem 0 .8rem;
    padding-left: 14px;
    border-left: 4px solid var(--brand);
}
.article-body .prose h3 { font-size: 1.15rem; font-weight: 800; color: #222; margin: 1.6rem 0 .6rem; }
.article-body .prose p { margin-bottom: 1.2rem; line-height: 2; }
.article-body .prose ul { padding-left: 0; list-style: none; margin-bottom: 1.2rem; }
.article-body .prose ul li { position: relative; padding-left: 22px; margin-bottom: .5rem; line-height: 1.9; }
.article-body .prose ul li::before { content: ''; position: absolute; left: 0; top: .6rem; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); }
.article-body .prose strong { color: #111; }
.article-body .prose a { color: var(--brand); text-decoration: underline; text-underline-offset: 2px; }

.cta-box {
    margin-top: 28px;
    padding: 18px 22px;
    background: linear-gradient(135deg, #fff5f5, #fff);
    border: 1px solid #ffcdd2;
    border-radius: var(--radius-md);
    font-size: .88rem;
    font-weight: 700;
    color: var(--brand-dark);
}

/* ===== Share Buttons ===== */
.share-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid #f0f0f0;
}
.share-bar .share-label { font-size: .72rem; font-weight: 800; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; }
.share-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: 50px;
    font-size: .75rem;
    font-weight: 700;
    color: #fff;
    transition: var(--transition);
}
.share-btn:hover { opacity: .9; transform: translateY(-1px); }
.share-btn.fb { background: #1877f2; }
.share-btn.wa { background: #25d366; }
.share-btn.tw { background: #111; }

/* ===== Source box ===== */
.source-box {
    margin-top: 24px;
    padding: 18px 22px;
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}
.source-box .source-info { font-size: .75rem; color: var(--text-muted); }
.source-box .source-info strong { color: var(--text); display: block; margin-bottom: 2px; }
.source-box .source-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #fff;
    border: 1.5px solid #ddd;
    color: var(--brand);
    font-size: .75rem;
    font-weight: 700;
    padding: 8px 18px;
    border-radius: 50px;
    transition: var(--transition);
}
.source-box .source-link:hover { border-color: var(--brand); background: #fff5f5; }

/* ===== Tags ===== */
.tags-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 20px; }
.tag { font-size: .68rem; font-weight: 700; color: #888; background: #f5f5f5; padding: 5px 12px; border-radius: 50px; }

/* ===== Related Posts ===== */
.related-section { margin-top: 40px; }
.related-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.related-card {
    background: #fff;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border);
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}
.related-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.related-card img { width: 100%; height: 140px; object-fit: cover; }
.related-card-body { padding: 14px; }
.related-card-body .r-meta { font-size: .66rem; color: var(--text-muted); font-weight: 600; margin-bottom: 5px; }
.related-card-body .r-title { font-size: .85rem; font-weight: 800; line-height: 1.35; color: #111; }

/* ===== Footer ===== */
.site-footer {
    background: #111;
    color: rgba(255,255,255,.5);
    margin-top: 60px;
}
.footer-inner {
    max-width: 1240px;
    margin: 0 auto;
    padding: 48px 20px 28px;
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr;
    gap: 40px;
}
@media (max-width: 768px) { .footer-inner { grid-template-columns: 1fr; gap: 32px; } }
.footer-logo { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.footer-logo .f-mark {
    width: 34px; height: 34px;
    background: var(--brand);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 900; font-size: .72rem;
}
.footer-logo .f-name { font-weight: 900; font-size: 1.05rem; color: #fff; }
.footer-desc { font-size: .78rem; line-height: 1.7; }
.footer-disclaimer { font-size: .68rem; color: rgba(255,255,255,.3); margin-top: 10px; }
.footer-col h4 { font-size: .8rem; font-weight: 800; color: #fff; margin-bottom: 14px; text-transform: uppercase; letter-spacing: .04em; }
.footer-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.footer-tags a {
    font-size: .7rem; font-weight: 600;
    padding: 5px 12px; border-radius: 50px;
    background: rgba(255,255,255,.08);
    transition: var(--transition);
}
.footer-tags a:hover { background: var(--brand); color: #fff; }
.footer-bottom {
    border-top: 1px solid rgba(255,255,255,.08);
    padding: 16px 20px;
    font-size: .7rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    max-width: 1240px;
    margin: 0 auto;
}
.footer-bottom a { color: rgba(255,255,255,.6); transition: var(--transition); }
.footer-bottom a:hover { color: #fff; }

/* ===== Pagination ===== */
.pagination { display: flex; justify-content: center; gap: 6px; margin-top: 32px; }
.pagination a, .pagination span {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 38px; height: 38px;
    font-size: .78rem; font-weight: 700; border-radius: 10px;
    transition: var(--transition);
}
.pagination a { background: #fff; border: 1px solid var(--border); color: #555; }
.pagination a:hover { border-color: var(--brand); color: var(--brand); }
.pagination .active { background: var(--brand); border-color: var(--brand); color: #fff; }
.pagination .disabled { color: #ccc; }

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding: 64px 20px;
    background: #fff;
    border-radius: var(--radius-xl);
    border: 2px dashed #ddd;
}
.empty-state p { font-size: .9rem; color: var(--text-muted); font-weight: 600; }

/* ===== Utility ===== */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.truncate-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.truncate-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
