:root { --bg:#FAF9F6; --card:#fff; --text:#111827; --muted:#5b6678; --line:#e2e8f0; --navy:#0F2537; --accent:#0F6470; }
html.dark { --bg:#020617; --card:#0f172a; --text:#f1f5f9; --muted:#a3b1c6; --line:#243044; --accent:#5cc8c4; }
* { box-sizing:border-box; margin:0; padding:0; }
[hidden] { display:none !important; }
body { background:var(--bg); color:var(--text); font-family:Inter,'Noto Sans Sinhala',sans-serif; line-height:1.6; -webkit-font-smoothing:antialiased; overflow-wrap:anywhere; }
a { color:inherit; }
button, input { font:inherit; color:inherit; }
button { cursor:pointer; }
.wrap { width:100%; max-width:1180px; margin:0 auto; padding-left:16px; padding-right:16px; }
.narrow { max-width:820px; }
h1, h2, h3 { line-height:1.3; }

#read-progress { position:fixed; top:0; left:0; height:3px; width:0; background:#2fb3ad; z-index:60; }

.topbar { position:sticky; top:0; z-index:40; background:var(--card); border-bottom:2px solid var(--accent); }
.topbar-row { display:flex; align-items:center; gap:12px; height:70px; }
.icon-btn { width:42px; height:42px; flex-shrink:0; border:1px solid var(--line); border-radius:10px; background:transparent; font-size:1.25rem; }
.brand { display:flex; align-items:center; gap:10px; text-decoration:none; flex:1; min-width:0; }
.brand img, footer img { width:48px; height:48px; border-radius:12px; background:#fff; object-fit:contain; padding:3px; flex-shrink:0; }
.brand strong { display:block; font-size:1.6rem; font-weight:800; line-height:1.1; color:var(--accent); }
.brand small { display:block; font-size:.68rem; line-height:1.3; color:var(--muted); }

#overlay { position:fixed; inset:0; background:rgba(2,6,23,.6); z-index:50; }
#drawer { position:fixed; top:0; bottom:0; left:0; width:min(320px,86vw); background:var(--card); z-index:55; padding:16px; overflow-y:auto; transform:translateX(-105%); transition:transform .25s; }
#drawer.open { transform:none; box-shadow:8px 0 30px rgba(0,0,0,.25); }
.drawer-head { display:flex; justify-content:space-between; align-items:center; margin-bottom:12px; }
.drawer-link { display:flex; justify-content:space-between; gap:10px; padding:11px 12px; border-radius:10px; text-decoration:none; font-weight:600; }
.drawer-link:hover, .drawer-link[aria-current] { background:var(--bg); color:var(--accent); }
.drawer-link small { color:var(--muted); }
.label { display:block; font-size:.7rem; font-weight:700; letter-spacing:.08em; text-transform:uppercase; color:var(--accent); }
#drawer .label { margin:16px 12px 6px; }

.hero { display:flex; align-items:center; gap:36px; margin-top:28px; padding:44px; border-radius:24px; color:#fff; background:linear-gradient(135deg,#0B2E4A,#0F6470); }
.hero img { width:180px; height:180px; border-radius:50%; background:#fff; padding:16px; object-fit:contain; flex-shrink:0; }
.hero h1 { font-size:clamp(1.8rem,4.5vw,3rem); font-weight:800; }
.hero .tagline { margin:10px 0 14px; font-family:Merriweather,serif; font-style:italic; font-size:clamp(1rem,2.4vw,1.4rem); color:#A7E3E0; }

.section-head { display:flex; flex-wrap:wrap; justify-content:space-between; align-items:center; gap:12px; margin:40px 0 20px; }
.section-head h2 { font-size:1.5rem; font-weight:800; border-left:6px solid var(--accent); padding-left:12px; }
input[type=search], input[type=email] { padding:10px 14px; border:1px solid var(--line); border-radius:10px; background:var(--card); min-width:0; }
.grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(min(100%,320px),1fr)); gap:24px; }
.card { display:flex; flex-direction:column; background:var(--card); border:1px solid var(--line); border-radius:16px; overflow:hidden; text-decoration:none; transition:transform .2s,box-shadow .2s; }
.card:hover { transform:translateY(-3px); box-shadow:0 10px 25px rgba(15,37,55,.14); }
.card-img { width:100%; aspect-ratio:16/9; object-fit:cover; display:block; }
.no-banner { object-fit:contain; background:#fff; padding:16px; }
.card-body { display:flex; flex-direction:column; gap:8px; padding:18px 20px; flex:1; }
.card h3 { font-family:Merriweather,'Noto Sans Sinhala',serif; font-size:1.15rem; }
.card p { font-size:.9rem; color:var(--muted); display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
.meta { font-size:.8rem; color:var(--muted); }
.card .meta { margin-top:auto; }
.empty { color:var(--muted); }

#categories { margin-bottom:48px; }
.cat-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(min(100%,230px),1fr)); gap:14px; }
.cat-card { display:flex; justify-content:space-between; align-items:center; gap:12px; padding:18px 20px; background:var(--card); border:1px solid var(--line); border-radius:14px; text-decoration:none; font-weight:700; }
.cat-card:hover, .cat-card[aria-current] { border-color:var(--accent); color:var(--accent); }
.cat-card small { background:var(--bg); border-radius:99px; padding:2px 10px; }

.subscribe { background:var(--navy); color:#fff; border-radius:18px; padding:28px; margin-bottom:48px; }
.subscribe form { display:flex; flex-wrap:wrap; gap:10px; margin-top:16px; }
.subscribe input { flex:1 1 220px; background:#fff; color:#111827; }
.subscribe button, .sources-btn { display:inline-block; padding:10px 20px; border:0; border-radius:10px; background:#0F6470; color:#fff; font-weight:600; text-decoration:none; }

#article-bar { position:sticky; z-index:30; background:var(--card); border-bottom:1px solid var(--line); }
.bar-row { display:flex; flex-wrap:wrap; justify-content:space-between; align-items:center; gap:8px; padding-top:10px; padding-bottom:10px; }
#back-link { font-size:.9rem; font-weight:600; text-decoration:none; color:var(--accent); }
.tools { display:flex; flex-wrap:wrap; gap:6px; }
.tool { padding:6px 11px; border:1px solid var(--line); border-radius:8px; background:var(--card); font-size:.78rem; font-weight:600; }
.tool[aria-pressed=true] { background:#0F6470; color:#fff; }
#reader { padding-top:36px; padding-bottom:36px; }
.chip { display:inline-block; padding:4px 12px; border-radius:6px; background:#0F6470; color:#fff; font-size:.72rem; font-weight:700; text-transform:uppercase; text-decoration:none; }
#reader > h1 { margin:16px 0; font-family:Merriweather,'Noto Sans Sinhala',serif; font-size:clamp(1.7rem,5vw,2.7rem); }
.standfirst { font-size:1.15rem; color:var(--muted); margin-bottom:12px; }
.banner { display:block; width:100%; height:auto; border-radius:16px; margin:24px 0; }
.prose { line-height:1.85; margin-bottom:28px; }
.prose > * + * { margin-top:1.1em; }
.prose h1, .prose h2, .prose h3 { margin-top:1.8em; }
.prose img { display:block; max-width:100%; height:auto; margin-left:auto; margin-right:auto; border-radius:12px; }
.prose ul, .prose ol { padding-left:1.5em; }
.prose a { color:var(--accent); }
.prose blockquote { border-left:4px solid var(--accent); padding-left:1em; font-style:italic; color:var(--muted); }
.prose pre { overflow-x:auto; padding:14px; border-radius:10px; background:#0f172a; color:#e2e8f0; line-height:1.5; }
.prose table { display:block; overflow-x:auto; border-collapse:collapse; }
.prose th, .prose td { border:1px solid var(--line); padding:8px 12px; }
html:not(.dark) #article-view.sepia { background:#F4ECD8; --bg:#F4ECD8; }
#related { padding-bottom:48px; }

#message-view { padding-top:70px; padding-bottom:90px; text-align:center; }
#message-view p { margin:14px 0 24px; }

footer { background:#0f172a; color:#cbd5e1; padding:32px 0; font-size:.9rem; }
footer .wrap { display:flex; flex-wrap:wrap; align-items:center; gap:16px; }
footer p:last-child { margin-left:auto; }

#toast { position:fixed; right:16px; bottom:16px; z-index:70; padding:12px 18px; border-radius:12px; background:#0f172a; color:#fff; opacity:0; pointer-events:none; transition:opacity .3s; }
#toast.show { opacity:1; }

@media (max-width:700px) {
    .hero { flex-direction:column; text-align:center; gap:20px; padding:28px 20px; }
    .hero img { width:130px; height:130px; }
    input[type=search] { width:100%; }
    footer p:last-child { margin-left:0; }
}
