/* =====================================================================
   Meridian News — public stylesheet
   Theming engine: structural tokens switch on [data-mode];
   accent/brand tokens switch on the theme class on <html>.
   ===================================================================== */

/* ---- Design tokens : light (default) ---- */
:root{
  --bg:#ffffff;
  --surface:#f6f7f9;
  --surface-2:#eef0f3;
  --ink:#11151c;
  --ink-soft:#37414f;
  --muted:#697586;
  --line:#e4e7ec;
  --line-strong:#cfd4dc;

  --accent:#c0322b;
  --accent-press:#9c2823;
  --accent-ink:#ffffff;
  --accent-soft:#fdeceb;

  --live:#d6202a;            /* breaking/live is always red */
  --live-ink:#ffffff;

  --maxw:1180px;
  --radius:12px;
  --radius-sm:8px;
  --shadow:0 1px 2px rgba(16,24,40,.06), 0 8px 24px -12px rgba(16,24,40,.18);
  --shadow-lg:0 24px 60px -24px rgba(16,24,40,.35);

  --font-display:"Newsreader","Georgia",serif;
  --font-body:"Inter",system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;
}

/* ---- Dark mode : structural overrides (theme-agnostic) ---- */
[data-mode="dark"]{
  --bg:#0e1116;
  --surface:#161b22;
  --surface-2:#1d242d;
  --ink:#eef1f5;
  --ink-soft:#c4ccd6;
  --muted:#8b95a3;
  --line:#262d36;
  --line-strong:#333c47;
  --shadow:0 1px 2px rgba(0,0,0,.4), 0 12px 30px -16px rgba(0,0,0,.7);
  --shadow-lg:0 30px 70px -28px rgba(0,0,0,.8);
}

/* ---- Theme accents ---- */
.theme-meridian{ --accent:#c0322b; --accent-press:#9c2823; --accent-soft:#fdeceb; }
[data-mode="dark"].theme-meridian{ --accent:#ef5b54; --accent-press:#d8463f; --accent-soft:#2a1715; }

.theme-geo{ --accent:#e8112d; --accent-press:#bf0d24; --accent-soft:#fdeaec; --font-display:"Inter",system-ui,sans-serif; }
[data-mode="dark"].theme-geo{ --accent:#ff4255; --accent-press:#e8112d; --accent-soft:#2a1014; }

.theme-midnight{ --accent:#6c8cff; --accent-press:#4f72f5; --accent-soft:#eaeefe; }
[data-mode="dark"].theme-midnight{ --accent:#8aa2ff; --accent-press:#6c8cff; --accent-soft:#161d33; }

.theme-ocean{ --accent:#0d7fb0; --accent-press:#0a6790; --accent-soft:#e7f4fa; }
[data-mode="dark"].theme-ocean{ --accent:#39a9d6; --accent-press:#1f8fbd; --accent-soft:#0e2530; }

.theme-forest{ --accent:#1f8a4c; --accent-press:#176f3d; --accent-soft:#e7f5ec; }
[data-mode="dark"].theme-forest{ --accent:#3fb873; --accent-press:#2f9a5e; --accent-soft:#102a1c; }

.theme-sunset{ --accent:#e0651a; --accent-press:#c25513; --accent-soft:#fdefe3; }
[data-mode="dark"].theme-sunset{ --accent:#ff8a3d; --accent-press:#ec6f24; --accent-soft:#2c1a0e; }

/* ---- Reset ---- */
*,*::before,*::after{ box-sizing:border-box; }
html{ -webkit-text-size-adjust:100%; scroll-behavior:smooth; }
body{
  margin:0; background:var(--bg); color:var(--ink);
  font-family:var(--font-body); font-size:16px; line-height:1.6;
  -webkit-font-smoothing:antialiased; text-rendering:optimizeLegibility;
}
img{ max-width:100%; display:block; }
a{ color:inherit; text-decoration:none; }
button{ font:inherit; cursor:pointer; }
h1,h2,h3,h4{ font-family:var(--font-display); line-height:1.12; margin:0; font-weight:600; letter-spacing:-.01em; }

.wrap{ max-width:var(--maxw); margin:0 auto; padding:0 20px; }
.sr-only{ position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0 0 0 0); border:0; }
:focus-visible{ outline:3px solid var(--accent); outline-offset:2px; border-radius:4px; }

/* =====================================================================
   Header
   ===================================================================== */
.topbar{
  background:var(--ink); color:#fff; font-size:12.5px;
  border-bottom:1px solid rgba(255,255,255,.08);
}
[data-mode="dark"] .topbar{ background:#05070a; }
.topbar .wrap{ display:flex; align-items:center; justify-content:space-between; height:38px; }
.topbar .date{ color:rgba(255,255,255,.7); letter-spacing:.02em; }
.topbar .tools{ display:flex; align-items:center; gap:14px; }
.topbar a{ color:rgba(255,255,255,.85); }
.topbar a:hover{ color:#fff; }
.livetv{
  display:inline-flex; align-items:center; gap:7px; background:var(--live); color:var(--live-ink);
  padding:4px 11px; border-radius:100px; font-weight:700; letter-spacing:.04em; font-size:11.5px;
}
.livetv .dot{ width:7px; height:7px; border-radius:50%; background:#fff; animation:pulse 1.4s infinite; }
@keyframes pulse{ 0%,100%{ opacity:1 } 50%{ opacity:.25 } }

.masthead{ background:var(--bg); border-bottom:1px solid var(--line); }
.masthead .wrap{ display:flex; align-items:center; justify-content:space-between; gap:18px; padding-top:18px; padding-bottom:18px; }
.brand{ display:flex; align-items:center; gap:12px; }
.brand .logo-mark{
  width:42px; height:42px; border-radius:11px; background:var(--accent); color:var(--accent-ink);
  display:grid; place-items:center; font-family:var(--font-display); font-weight:700; font-size:24px; flex:none;
}
.brand .logo-text{ display:flex; flex-direction:column; line-height:1.05; }
.brand .logo-text b{ font-family:var(--font-display); font-size:26px; font-weight:700; letter-spacing:-.02em; }
.brand .logo-text span{ font-size:11.5px; color:var(--muted); letter-spacing:.04em; }

.masthead-actions{ display:flex; align-items:center; gap:8px; }
.iconbtn{
  width:42px; height:42px; border-radius:10px; border:1px solid var(--line); background:var(--surface);
  color:var(--ink); display:grid; place-items:center; transition:background .15s, border-color .15s;
}
.iconbtn:hover{ background:var(--surface-2); border-color:var(--line-strong); }
.iconbtn svg{ width:20px; height:20px; }

/* Nav */
.nav{ background:var(--bg); border-bottom:2px solid var(--ink); position:sticky; top:0; z-index:40; }
[data-mode="dark"] .nav{ border-bottom-color:var(--accent); }
.nav .wrap{ display:flex; align-items:center; gap:4px; height:52px; overflow-x:auto; scrollbar-width:none; }
.nav .wrap::-webkit-scrollbar{ display:none; }
.nav a{
  padding:8px 14px; font-size:14.5px; font-weight:600; color:var(--ink-soft); white-space:nowrap;
  border-bottom:3px solid transparent; margin-bottom:-2px; transition:color .15s;
}
.nav a:hover{ color:var(--accent); }
.nav a.active{ color:var(--accent); border-bottom-color:var(--accent); }
.nav .home-link{ color:var(--ink); }

/* mobile menu button */
.menu-toggle{ display:none; }
@media (max-width:760px){
  .menu-toggle{ display:grid; }
  .nav{ display:none; }
  .nav.open{ display:block; position:fixed; inset:0 0 0 auto; width:min(320px,84vw); top:0; height:100dvh;
    background:var(--bg); box-shadow:var(--shadow-lg); z-index:90; border:0; padding:64px 0 20px; }
  .nav.open .wrap{ flex-direction:column; align-items:stretch; height:auto; overflow:visible; }
  .nav.open a{ border-bottom:1px solid var(--line); margin:0; padding:14px 24px; }
  .nav.open a.active{ border-left:3px solid var(--accent); border-bottom-color:var(--line); }
  .nav-backdrop{ position:fixed; inset:0; background:rgba(0,0,0,.45); z-index:80; }
}

/* =====================================================================
   Breaking ticker
   ===================================================================== */
.ticker{ background:var(--ink); color:#fff; display:flex; align-items:stretch; overflow:hidden; }
[data-mode="dark"] .ticker{ background:#05070a; }
.ticker .label{
  background:var(--live); color:var(--live-ink); font-weight:800; letter-spacing:.06em; font-size:12px;
  display:flex; align-items:center; padding:0 16px; white-space:nowrap; flex:none; position:relative;
}
.ticker .label::after{ content:""; position:absolute; right:-9px; top:0; bottom:0; width:18px; background:var(--live); transform:skewX(-16deg); }
.ticker .track-wrap{ overflow:hidden; flex:1; position:relative; }
.ticker .track{ display:inline-flex; gap:42px; padding:11px 24px; white-space:nowrap; animation:ticker 34s linear infinite; }
.ticker:hover .track{ animation-play-state:paused; }
.ticker .track a{ font-size:13.5px; color:rgba(255,255,255,.92); }
.ticker .track a::before{ content:"›"; color:var(--accent); margin-right:9px; font-weight:700; }
@keyframes ticker{ from{ transform:translateX(0) } to{ transform:translateX(-50%) } }
@media (prefers-reduced-motion:reduce){ .ticker .track{ animation:none; } }

/* =====================================================================
   Hero / featured slider
   ===================================================================== */
.section{ padding:38px 0; }
.section-head{ display:flex; align-items:baseline; justify-content:space-between; margin-bottom:20px; gap:16px; }
.section-head h2{ font-size:24px; position:relative; padding-left:16px; }
.section-head h2::before{ content:""; position:absolute; left:0; top:3px; bottom:3px; width:5px; background:var(--accent); border-radius:3px; }
.section-head a.more{ font-size:13.5px; font-weight:600; color:var(--accent); }

.hero{ display:grid; grid-template-columns:1.7fr 1fr; gap:22px; margin-top:26px; }
.slider{ position:relative; border-radius:var(--radius); overflow:hidden; background:var(--surface-2); box-shadow:var(--shadow); min-height:440px; }
.slide{ position:absolute; inset:0; opacity:0; transition:opacity .6s ease; display:flex; align-items:flex-end; }
.slide.active{ opacity:1; position:relative; }
.slide .ph,.slide img{ position:absolute; inset:0; width:100%; height:100%; object-fit:cover; }
.slide .scrim{ position:absolute; inset:0; background:linear-gradient(to top, rgba(8,10,14,.92) 0%, rgba(8,10,14,.55) 38%, rgba(8,10,14,.05) 72%); }
.slide .slide-body{ position:relative; padding:30px 32px; color:#fff; max-width:680px; }
.slide .kicker{ display:inline-block; background:var(--accent); color:var(--accent-ink); font-size:11.5px; font-weight:700;
  letter-spacing:.05em; text-transform:uppercase; padding:5px 11px; border-radius:5px; margin-bottom:14px; }
.slide h2{ font-size:clamp(24px,3.4vw,40px); color:#fff; }
.slide .meta{ margin-top:12px; font-size:13px; color:rgba(255,255,255,.78); }
.slider .dots{ position:absolute; right:18px; bottom:18px; display:flex; gap:8px; z-index:3; }
.slider .dots button{ width:10px; height:10px; border-radius:50%; border:0; background:rgba(255,255,255,.45); padding:0; }
.slider .dots button.on{ background:#fff; width:26px; border-radius:6px; }
.slider .arrow{ position:absolute; top:50%; transform:translateY(-50%); z-index:3; width:42px; height:42px; border-radius:50%;
  border:0; background:rgba(0,0,0,.4); color:#fff; display:grid; place-items:center; backdrop-filter:blur(4px); }
.slider .arrow:hover{ background:rgba(0,0,0,.65); }
.slider .arrow.prev{ left:14px; } .slider .arrow.next{ right:14px; }

.hero-side{ display:flex; flex-direction:column; gap:14px; }
.hero-side .side-card{ display:grid; grid-template-columns:96px 1fr; gap:14px; padding-bottom:14px; border-bottom:1px solid var(--line); }
.hero-side .side-card:last-child{ border-bottom:0; }
.hero-side .thumb{ width:96px; height:72px; border-radius:8px; overflow:hidden; background:var(--surface-2); }
.hero-side .thumb img,.hero-side .thumb .ph{ width:100%; height:100%; object-fit:cover; }
.hero-side h3{ font-size:16px; line-height:1.28; }
.hero-side h3:hover{ color:var(--accent); }
.hero-side .meta{ font-size:12px; color:var(--muted); margin-top:6px; }

/* =====================================================================
   Cards / grids
   ===================================================================== */
.grid{ display:grid; gap:24px; }
.grid.cols-3{ grid-template-columns:repeat(3,1fr); }
.grid.cols-4{ grid-template-columns:repeat(4,1fr); }
.layout{ display:grid; grid-template-columns:1fr 320px; gap:36px; align-items:start; }

.card{ background:var(--bg); border:1px solid var(--line); border-radius:var(--radius); overflow:hidden;
  display:flex; flex-direction:column; transition:transform .18s, box-shadow .18s, border-color .18s; }
.card:hover{ transform:translateY(-3px); box-shadow:var(--shadow); border-color:var(--line-strong); }
.card .media{ aspect-ratio:16/10; background:var(--surface-2); overflow:hidden; position:relative; }
.card .media img,.card .media .ph{ width:100%; height:100%; object-fit:cover; transition:transform .4s; }
.card:hover .media img{ transform:scale(1.05); }
.card .body{ padding:16px 18px 20px; display:flex; flex-direction:column; gap:9px; flex:1; }
.card h3{ font-size:18.5px; line-height:1.25; }
.card:hover h3{ color:var(--accent); }
.card p{ margin:0; font-size:14px; color:var(--muted); line-height:1.5; }
.card .meta{ margin-top:auto; font-size:12.5px; color:var(--muted); display:flex; gap:10px; align-items:center; flex-wrap:wrap; }

.cat-chip{ display:inline-block; font-size:11px; font-weight:700; letter-spacing:.04em; text-transform:uppercase;
  color:var(--accent); }
.cat-chip.solid{ background:var(--accent); color:var(--accent-ink); padding:4px 9px; border-radius:5px; }
.dot-sep::before{ content:"•"; margin-right:10px; color:var(--line-strong); }

/* video play badge */
.play-badge{ position:absolute; inset:0; display:grid; place-items:center; }
.play-badge span{ width:54px; height:54px; border-radius:50%; background:rgba(0,0,0,.55); display:grid; place-items:center; }
.play-badge svg{ width:22px; height:22px; fill:#fff; margin-left:3px; }

/* placeholder graphic when no image */
.ph{ background:
   radial-gradient(circle at 30% 30%, color-mix(in srgb,var(--accent) 22%, transparent), transparent 60%),
   var(--surface-2);
   display:grid; place-items:center; }
.ph::after{ content:""; width:38%; height:38%; border-radius:50%;
   background:repeating-conic-gradient(color-mix(in srgb,var(--accent) 40%,transparent) 0 12deg, transparent 12deg 24deg);
   opacity:.5; }

/* =====================================================================
   Sidebar
   ===================================================================== */
.side-block{ background:var(--surface); border:1px solid var(--line); border-radius:var(--radius); padding:20px; margin-bottom:24px; }
.side-block h3{ font-size:16px; text-transform:uppercase; letter-spacing:.04em; padding-bottom:12px; margin-bottom:14px;
  border-bottom:2px solid var(--accent); display:inline-block; font-family:var(--font-body); font-weight:800; }
.rank-list{ list-style:none; margin:0; padding:0; counter-reset:rank; }
.rank-list li{ display:grid; grid-template-columns:34px 1fr; gap:12px; padding:12px 0; border-bottom:1px solid var(--line); align-items:start; }
.rank-list li:last-child{ border-bottom:0; }
.rank-list .num{ counter-increment:rank; font-family:var(--font-display); font-size:26px; font-weight:700; color:var(--accent); line-height:1; }
.rank-list .num::before{ content:counter(rank); }
.rank-list h4{ font-size:14.5px; font-family:var(--font-body); font-weight:600; line-height:1.34; margin:0; }
.rank-list a:hover h4{ color:var(--accent); }
.rank-list .meta{ font-size:11.5px; color:var(--muted); margin-top:5px; }

.newsletter input{ width:100%; padding:11px 13px; border:1px solid var(--line-strong); border-radius:8px; background:var(--bg);
  color:var(--ink); margin-bottom:10px; }
.btn{ display:inline-flex; align-items:center; justify-content:center; gap:8px; background:var(--accent); color:var(--accent-ink);
  border:0; border-radius:8px; padding:11px 18px; font-weight:700; font-size:14px; transition:background .15s; width:100%; }
.btn:hover{ background:var(--accent-press); }
.btn.ghost{ background:transparent; color:var(--accent); border:1px solid var(--accent); }

/* =====================================================================
   Article page
   ===================================================================== */
.article-head{ max-width:780px; margin:0 auto; padding:34px 0 6px; }
.breadcrumb{ font-size:13px; color:var(--muted); margin-bottom:16px; }
.breadcrumb a:hover{ color:var(--accent); }
.article-head h1{ font-size:clamp(28px,4.4vw,46px); line-height:1.1; margin:10px 0 16px; }
.article-lede{ font-size:19px; color:var(--ink-soft); line-height:1.55; font-family:var(--font-display); }
.byline{ display:flex; align-items:center; gap:14px; margin:22px 0; padding:16px 0; border-top:1px solid var(--line); border-bottom:1px solid var(--line); flex-wrap:wrap; }
.byline .avatar{ width:44px; height:44px; border-radius:50%; background:var(--accent); color:var(--accent-ink); display:grid; place-items:center; font-weight:700; }
.byline .who b{ font-size:14.5px; } .byline .who span{ display:block; font-size:12.5px; color:var(--muted); }
.byline .share{ margin-left:auto; display:flex; gap:8px; }
.figure{ margin:24px auto; max-width:980px; }
.figure img{ width:100%; border-radius:var(--radius); }
.figure figcaption{ font-size:12.5px; color:var(--muted); margin-top:8px; text-align:center; }
.video-embed{ position:relative; padding-top:56.25%; border-radius:var(--radius); overflow:hidden; margin:24px auto; max-width:980px; }
.video-embed iframe{ position:absolute; inset:0; width:100%; height:100%; border:0; }

.article-body{ max-width:720px; margin:0 auto; font-size:18px; line-height:1.74; color:var(--ink); }
.article-body p{ margin:0 0 1.25em; }
.article-body h2{ font-size:27px; margin:1.6em 0 .5em; }
.article-body h3{ font-size:21px; margin:1.4em 0 .4em; }
.article-body a{ color:var(--accent); text-decoration:underline; text-underline-offset:3px; }
.article-body blockquote{ margin:1.4em 0; padding:6px 0 6px 22px; border-left:4px solid var(--accent); font-family:var(--font-display); font-size:21px; color:var(--ink-soft); }
.article-body img{ border-radius:var(--radius); margin:1.4em 0; }
.article-body ul,.article-body ol{ padding-left:1.4em; margin:0 0 1.25em; }
.article-body li{ margin:.35em 0; }
.tag-row{ max-width:720px; margin:30px auto 0; display:flex; gap:10px; flex-wrap:wrap; }
.tag{ font-size:13px; background:var(--surface); border:1px solid var(--line); border-radius:100px; padding:6px 14px; color:var(--ink-soft); }

/* =====================================================================
   Search
   ===================================================================== */
.searchbar{ display:flex; gap:10px; max-width:640px; margin:0 auto 8px; }
.searchbar input{ flex:1; padding:14px 16px; font-size:16px; border:1px solid var(--line-strong); border-radius:10px; background:var(--bg); color:var(--ink); }
.searchbar .btn{ width:auto; padding:0 24px; }
.page-title{ text-align:center; font-size:30px; margin-bottom:6px; }
.muted-center{ text-align:center; color:var(--muted); margin-bottom:26px; }
.empty{ text-align:center; padding:60px 20px; color:var(--muted); }

/* pagination */
.pagination{ display:flex; justify-content:center; gap:8px; margin-top:34px; }
.pagination a,.pagination span{ min-width:42px; height:42px; display:grid; place-items:center; border:1px solid var(--line); border-radius:8px; font-weight:600; font-size:14px; padding:0 12px; }
.pagination a:hover{ border-color:var(--accent); color:var(--accent); }
.pagination .current{ background:var(--accent); color:var(--accent-ink); border-color:var(--accent); }

/* =====================================================================
   Footer
   ===================================================================== */
.footer{ background:var(--ink); color:#cfd6df; margin-top:50px; }
[data-mode="dark"] .footer{ background:#05070a; }
.footer .top{ display:grid; grid-template-columns:1.4fr 1fr 1fr 1fr; gap:32px; padding:48px 0 38px; }
.footer h4{ color:#fff; font-family:var(--font-body); font-weight:800; font-size:13px; letter-spacing:.06em; text-transform:uppercase; margin-bottom:16px; }
.footer ul{ list-style:none; padding:0; margin:0; }
.footer li{ margin:9px 0; }
.footer a{ color:#aeb7c2; font-size:14px; }
.footer a:hover{ color:#fff; }
.footer .brand .logo-text b{ color:#fff; }
.footer .blurb{ font-size:14px; color:#9aa4b1; margin-top:14px; max-width:34ch; }
.footer .social{ display:flex; gap:10px; margin-top:16px; }
.footer .social a{ width:38px; height:38px; border-radius:9px; background:rgba(255,255,255,.08); display:grid; place-items:center; }
.footer .social svg{ width:18px; height:18px; fill:#cfd6df; }
.footer .bottom{ border-top:1px solid rgba(255,255,255,.1); padding:18px 0; font-size:13px; color:#8c97a4; display:flex; justify-content:space-between; flex-wrap:wrap; gap:10px; }

/* =====================================================================
   Responsive
   ===================================================================== */
@media (max-width:980px){
  .hero{ grid-template-columns:1fr; }
  .layout{ grid-template-columns:1fr; }
  .grid.cols-4{ grid-template-columns:repeat(2,1fr); }
  .grid.cols-3{ grid-template-columns:repeat(2,1fr); }
  .footer .top{ grid-template-columns:1fr 1fr; }
}
@media (max-width:560px){
  .grid.cols-4,.grid.cols-3{ grid-template-columns:1fr; }
  .topbar .date{ display:none; }
  .brand .logo-text b{ font-size:22px; }
  .footer .top{ grid-template-columns:1fr; }
  .slider{ min-height:340px; }
  .article-body{ font-size:17px; }
}
