:root {
    --bg-dark: #111111;
    --bg-header: rgba(17, 17, 17, 0.95);
    --bg-light: #f9f9f9;
    --text-dark: #333333;
    --text-light: #ffffff;
    --accent: #d32f2f;
    --border-color: #eaeaea;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Noto Sans Sinhala', sans-serif; background: var(--bg-light); color: var(--text-dark); line-height: 1.6; }
a { text-decoration: none; color: inherit; }

/* Global Header */
.site-header {
    position: sticky; top: 0; z-index: 1000;
    background: var(--bg-header); backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255,255,255,0.1);
    transition: all 0.3s ease;
}
.header-container {
    display: flex; justify-content: space-between; align-items: center;
    max-width: 1200px; margin: 0 auto; padding: 15px 20px;
}
.site-logo { color: var(--text-light); font-size: 1.5rem; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.site-logo img { height: 30px; }
.main-nav { display: flex; gap: 20px; }
.nav-link { color: var(--text-light); font-size: 0.9rem; text-transform: uppercase; transition: color 0.3s; }
.nav-link:hover, .nav-link.active { color: var(--accent); }
.mobile-menu-toggle { display: none; background: none; border: none; color: #fff; font-size: 1.5rem; cursor: pointer; }

/* Hero Section */
.hero-section { position: relative; height: 62vh; width: 100%; overflow: hidden; background: #000; }
.hero-slider { width: 100%; height: 100%; position: relative; }
.hero-slide {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background-size: cover; background-position: center; background-attachment: fixed;
    opacity: 0; transition: opacity 1s ease-in-out;
}
.hero-slide.active { opacity: 1; }
@media (max-width: 768px) {
    /* background-attachment: fixed is unreliable on mobile Safari/Chrome
       and can cause janky scrolling, so it's disabled below the desktop
       breakpoint - the hero still displays correctly, just scrolls normally. */
    .hero-slide { background-attachment: scroll; }
}

/* Overlays (Featured & Events) */
.hero-overlays {
    position: absolute; bottom: 0; left: 0; width: 100%;
    display: flex; justify-content: center; gap: 2px;
}
.overlay-box {
    background: rgba(17, 17, 17, 0.55); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    color: var(--text-light);
    width: 50%; max-width: 400px; padding: 30px;
    height: 200px; display: flex; flex-direction: column; overflow: hidden;
    position: relative;
}
.box-header { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 2px; margin-bottom: 20px; border-bottom: 1px solid #444; padding-bottom: 10px; }
.box-content-slider { position: relative; flex: 1; }
.box-slide {
    position: absolute; top: 0; left: 0; width: 100%;
    opacity: 0; transform: translateX(-24px); pointer-events: none;
    transition: opacity 0.6s ease, transform 0.6s ease;
}
.box-slide.active { opacity: 1; transform: translateX(0); pointer-events: auto; }
.topic-title { font-size: 1.2rem; margin-bottom: 5px; }
.meta-section, .meta-writer { display: block; font-size: 0.85rem; color: #aaa; }
.btn-read-more { display: inline-block; margin-top: 15px; font-size: 0.8rem; border: 1px solid #fff; padding: 5px 15px; transition: 0.3s; }
.btn-read-more:hover { background: #fff; color: #000; }
/* Read More is deliberately OUTSIDE .box-content-slider (see index.php) so
   it never participates in the slide fade/transform - it stays put while
   the title/section/author rotate above it, and its href is kept in sync
   with the active slide via main.js. */
.fixed-read-more { align-self: flex-end; margin-top: 12px; flex-shrink: 0; }
.event-layout { display: flex; gap: 20px; align-items: center; }
.event-date { text-align: center; border: 1px solid #555; padding: 10px; border-radius: 4px; }
.event-date .day { display: block; font-size: 1.5rem; font-weight: bold; }
.event-date .mon { display: block; font-size: 0.8rem; text-transform: uppercase; }

/* Ticker */
.topic-ticker-container { background: #000; color: #fff; padding: 10px 0; overflow: hidden; border-bottom: 1px solid #333; }
.ticker-wrapper { width: 100%; overflow: hidden; white-space: nowrap; }
.ticker-content { display: inline-block; animation: marquee 30s linear infinite; }
.ticker-content:hover { animation-play-state: paused; }
.ticker-item { margin: 0 30px; font-size: 0.9rem; transition: color 0.3s; }
.ticker-item:hover { color: var(--accent); }
@keyframes marquee { 0% { transform: translateX(0); } 100% { transform: translateX(-50%); } }

/* Section Nav */
.horizontal-section-nav {
    background: #e5e5e5; padding: 15px 0; border-bottom: 1px solid #ccc; text-align: center;
    position: sticky; z-index: 900;
    /* top offset is set by main.js to match the real rendered header height */
}
.nav-container { display: flex; justify-content: center; gap: 30px; flex-wrap: wrap; max-width: 1200px; margin: 0 auto; }
.sec-link { font-size: 1rem; color: #444; position: relative; padding-bottom: 5px; }
.sec-link::after { content: ''; position: absolute; bottom: 0; left: 0; width: 0; height: 2px; background: var(--accent); transition: width 0.3s; }
.sec-link:hover::after { width: 100%; }

/* Latest Articles Grid */
.latest-articles-section { max-width: 1200px; margin: 50px auto; padding: 0 20px; width: 75vw; }
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 30px; border-bottom: 2px solid #000; padding-bottom: 10px; }
.view-all { font-size: 0.85rem; font-weight: bold; text-transform: uppercase; }
.article-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 30px; }
.article-card { background: #fff; border: 1px solid var(--border-color); cursor: pointer; transition: transform 0.3s, box-shadow 0.3s; display: flex; flex-direction: column; }
.article-card:hover { transform: translateY(-5px); box-shadow: 0 10px 20px rgba(0,0,0,0.05); }
.card-image { position: relative; height: 200px; overflow: hidden; }
.card-image img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s; }
.article-card:hover .card-image img { transform: scale(1.05); }
.card-badge { position: absolute; top: 10px; left: 10px; background: var(--accent); color: #fff; padding: 3px 10px; font-size: 0.75rem; text-transform: uppercase; }
.card-content { padding: 20px; flex: 1; }
.card-title { font-size: 1.1rem; margin-bottom: 10px; line-height: 1.4; }
.card-excerpt { font-size: 0.9rem; color: #666; margin-bottom: 15px; }

/* Pagination */
.pagination { display: flex; justify-content: center; gap: 8px; margin-top: 40px; flex-wrap: wrap; }
.page-link {
    display: inline-block; min-width: 38px; text-align: center; padding: 8px 12px;
    border: 1px solid var(--border-color); border-radius: 4px; font-size: 0.9rem; color: var(--text-dark);
    transition: 0.2s;
}
.page-link:hover { border-color: var(--accent); color: var(--accent); }
.page-current { background: var(--accent); color: #fff; border-color: var(--accent); }
.card-writer { font-size: 0.85rem; font-weight: bold; color: #333; }
.card-stats { display: flex; justify-content: flex-end; gap: 15px; padding: 15px 20px; border-top: 1px solid var(--border-color); font-size: 0.8rem; color: #888; }

/* Footer */
.site-footer { background: var(--bg-dark); color: #888; padding: 40px 20px; text-align: center; margin-top: 50px; }
.footer-socials { margin-bottom: 20px; }
.footer-socials a { color: #fff; margin: 0 10px; font-size: 1.2rem; transition: color 0.3s; }
.footer-socials a:hover { color: var(--accent); }
.footer-copy p { font-size: 0.85rem; margin: 5px 0; }

/* ============================================
   Shared inner-page components
   (buttons, forms, page headers, cards) -
   built in the same visual language as the
   homepage: --accent red, clean bordered cards,
   uppercase tracked labels, generous whitespace.
   ============================================ */

.content-wrap { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* Page hero band - dark header used on About/Contact/Events/Article pages */
.page-hero { background: var(--bg-dark); color: #fff; padding: 60px 0; text-align: center; }
.page-hero .eyebrow { display: block; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 2px; color: var(--accent); margin-bottom: 10px; }
.page-hero h1 { font-size: 2.2rem; margin: 0; color: #fff; }
.page-hero .hero-meta { color: #ccc; font-size: 0.9rem; margin-top: 12px; }
.page-hero-image {
    background-size: cover; background-position: center; position: relative;
}
.page-hero-image::before { content: ''; position: absolute; inset: 0; background: rgba(17,17,17,0.65); }
.page-hero-image .content-wrap { position: relative; z-index: 1; }

.page-body { padding: 50px 0 70px; }

/* Buttons */
.btn {
    display: inline-block; background: var(--accent); color: #fff; border: none;
    padding: 12px 26px; font-size: 0.9rem; font-weight: 600; letter-spacing: 0.3px;
    cursor: pointer; transition: 0.25s; text-align: center; text-transform: uppercase;
}
.btn:hover { background: #a82424; }
.btn-outline { background: transparent; border: 1px solid var(--accent); color: var(--accent); }
.btn-outline:hover { background: var(--accent); color: #fff; }
.btn-sm { padding: 7px 16px; font-size: 0.8rem; }
.btn-block { width: 100%; }
.btn-danger { background: #444; }
.btn-danger:hover { background: #222; }

/* Forms */
.form-group { margin-bottom: 18px; text-align: left; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-dark); }
.form-control {
    width: 100%; padding: 12px 14px; border: 1px solid var(--border-color);
    font: inherit; font-size: 0.95rem; background: #fff; transition: border-color 0.2s;
}
.form-control:focus { outline: none; border-color: var(--accent); }
textarea.form-control { resize: vertical; min-height: 130px; }
.form-hint { color: #888; font-size: 0.85rem; margin-top: 8px; }
.form-error { background: #fdecea; color: #b71c1c; padding: 12px 16px; margin-bottom: 18px; font-size: 0.9rem; border-left: 3px solid #b71c1c; }
.form-success { background: #eaf7ea; color: #1b5e20; padding: 12px 16px; margin-bottom: 18px; font-size: 0.9rem; border-left: 3px solid #1b5e20; }

/* Generic bordered panel (forms, info blocks) */
.panel-card { background: #fff; border: 1px solid var(--border-color); padding: 34px; box-shadow: 0 5px 20px rgba(0,0,0,0.04); }
.auth-card { max-width: 420px; margin: 0 auto; text-align: center; }
.auth-card h1 { font-size: 1.5rem; margin-bottom: 24px; }

.section-title-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 28px; border-bottom: 2px solid #000; padding-bottom: 10px; }
.section-title-row h1, .section-title-row h2 { font-size: 1.6rem; margin: 0; }

.empty-state { text-align: center; padding: 50px 20px; color: #888; }

.badge {
    display: inline-block; background: var(--accent); color: #fff;
    padding: 4px 12px; font-size: 0.75rem; text-transform: uppercase;
    letter-spacing: 0.5px; margin-bottom: 14px;
}
.badge a { color: #fff; }

/* Filter pills (articles listing) - visually matches .sec-link/.horizontal-section-nav */
.filter-bar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 30px; }
.filter-chip { padding: 8px 18px; border: 1px solid var(--border-color); font-size: 0.85rem; color: var(--text-dark); transition: 0.2s; }
.filter-chip:hover { border-color: var(--accent); color: var(--accent); }
.filter-chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Two-column layout (contact page) */
.two-col-layout { display: grid; grid-template-columns: 1.3fr 1fr; gap: 32px; align-items: start; }
.contact-info-card h3 { font-size: 1rem; margin-bottom: 18px; text-transform: uppercase; letter-spacing: 1px; }
.contact-info-line { display: flex; gap: 10px; align-items: flex-start; font-size: 0.95rem; padding: 12px 0; border-bottom: 1px solid var(--border-color); }
.contact-info-line:last-child { border-bottom: none; }
.contact-icon { flex-shrink: 0; opacity: 0.7; }

/* Article detail page */
.article-prose { max-width: 760px; margin: 0 auto; font-size: 1.05rem; line-height: 1.8; }
.article-prose img { max-width: 100%; height: auto; margin: 20px 0; }
.article-prose h2, .article-prose h3 { margin: 1.4em 0 0.6em; }
.article-cover-wrap { position: relative; max-width: 760px; margin: 0 auto 30px; overflow: hidden; background: #000; }
.article-cover-bg { position: absolute; inset: 0; background-size: cover; background-position: center; filter: blur(30px) brightness(0.7); opacity: 0.5; transform: scale(1.15); }
.article-cover-img { position: relative; z-index: 1; display: block; width: 100%; max-height: 480px; object-fit: contain; margin: 0 auto; }

.engagement-bar { max-width: 760px; margin: 30px auto; padding: 20px 0; border-top: 1px solid var(--border-color); border-bottom: 1px solid var(--border-color); text-align: center; }
.like-btn {
    display: inline-flex; align-items: center; gap: 8px; padding: 10px 22px;
    border: 1px solid var(--border-color); background: #fff; font: inherit; font-size: 0.9rem;
    font-weight: 600; cursor: pointer; transition: 0.2s;
}
.like-btn:hover { border-color: var(--accent); }
.like-btn.liked { border-color: var(--accent); background: #fdecea; color: var(--accent); }
.like-icon::before { content: "\2661"; }
.like-btn.liked .like-icon::before { content: "\2665"; }

.related-section { max-width: 900px; margin: 50px auto 0; }
.related-section h2 { font-size: 1.3rem; margin-bottom: 20px; }

.comments-section { max-width: 760px; margin: 40px auto 0; }
.comments-section h2 { font-size: 1.3rem; margin-bottom: 20px; }
.comment-list { margin-bottom: 30px; }
.comment { padding: 16px 0; border-bottom: 1px solid var(--border-color); }
.comment-author { font-weight: 700; font-size: 0.9rem; }
.comment-date { font-size: 0.8rem; color: #999; margin-bottom: 6px; }
.comment-body { margin: 0; font-size: 0.95rem; }
.comment-form-card h3 { font-size: 1rem; margin-bottom: 16px; }

/* Events listing page */
.event-list-item {
    display: flex; gap: 24px; align-items: center; padding: 24px; background: #fff;
    border: 1px solid var(--border-color); margin-bottom: 16px; transition: 0.25s;
}
.event-list-item:hover { box-shadow: 0 8px 20px rgba(0,0,0,0.06); transform: translateY(-2px); }
.event-list-item .event-date { flex-shrink: 0; width: 70px; height: 70px; display: flex; flex-direction: column; align-items: center; justify-content: center; border: 1px solid var(--border-color); color: var(--text-dark); }
.event-list-item .event-date .day { font-size: 1.4rem; }
.event-list-item h3 { font-size: 1.1rem; margin-bottom: 4px; }
.event-list-item .event-meta { font-size: 0.85rem; color: #888; }
.event-list-item.past { opacity: 0.6; }
@media (max-width: 992px) {
    .article-grid { grid-template-columns: repeat(2, 1fr); }
    .latest-articles-section { width: 90vw; }
}
@media (max-width: 768px) {
    .main-nav { display: none; } /* Add JS toggle for mobile menu */
    .mobile-menu-toggle { display: block; }
    .hero-section { height: 55vh; }
    .hero-overlays { flex-direction: column; bottom: -50px; position: relative; background: #000; }
    .overlay-box { width: 100%; max-width: 100%; height: auto; }
    .article-grid { grid-template-columns: 1fr; }
    .latest-articles-section { width: 95vw; }
    .two-col-layout { grid-template-columns: 1fr; }
    .event-list-item { flex-direction: column; text-align: center; }
}