/* The Maple Wire — Canadian viral news style */
:root {
  --red: #d52b1e;              /* primary: Canadian flag red */
  --red-dark: #a01e14;         /* primary-dark */
  --accent-red: #d52b1e;       /* pop red for kickers, badges */
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --line: #e2e8f0;
  --bg: #ffffff;
  --bg-2: #f8fafc;
  --accent: #ffffff;           /* white on red */
  --shadow: 0 1px 2px rgba(20,23,31,.06), 0 4px 12px rgba(20,23,31,.04);
  --radius: 6px;
  --max: 1240px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-head: "Merriweather", Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
a:hover { color: var(--red); }
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { font-family: var(--font-head); color: var(--ink); margin: 0 0 8px; line-height: 1.2; }
.container { max-width: var(--max); margin: 0 auto; padding: 0 20px; }

/* Top strip */
.topbar {
  background: var(--ink);
  color: #fff;
  font-size: 12px;
  padding: 6px 0;
}
.topbar .container { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.topbar a { color: #d7dbe3; margin-left: 14px; }
.topbar a:hover { color: #fff; }
.topbar .date { color: #b7bcc7; }

/* Masthead */
.masthead {
  background: var(--red);
  color: #fff;
  padding: 14px 0;
  border-bottom: 4px solid var(--ink);
}
.masthead .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.brand {
  font-family: var(--font-head);
  font-weight: 900;
  font-size: 34px;
  letter-spacing: -0.5px;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand .pulse-dot {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(255,230,0,.25);
  animation: pulse 1.6s ease-out infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(255,230,0,.55); }
  100% { box-shadow: 0 0 0 14px rgba(255,230,0,0); }
}
.brand small { display: block; font-size: 11px; font-weight: 500; opacity: .9; letter-spacing: 2px; }

.searchbox {
  display: flex; background: #fff; border-radius: 40px; overflow: hidden;
  border: 2px solid rgba(0,0,0,.08); min-width: 260px;
}
.searchbox input { border: 0; outline: 0; padding: 8px 14px; flex: 1; font-size: 14px; }
.searchbox button { border: 0; background: var(--ink); color: #fff; padding: 0 16px; cursor: pointer; }

/* Nav */
.mainnav {
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 40;
  box-shadow: var(--shadow);
}
.mainnav .container { display: flex; align-items: center; gap: 4px; overflow-x: auto; }
.mainnav a {
  padding: 14px 14px;
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
  border-bottom: 3px solid transparent;
}
.mainnav a:hover, .mainnav a.active {
  color: var(--red);
  border-bottom-color: var(--red);
}
.mainnav .live {
  background: var(--red); color: #fff; padding: 3px 8px; border-radius: 3px;
  font-size: 11px; margin-left: 6px;
}

/* Breaking bar */
.breaking {
  background: #fff2c9;
  border-bottom: 1px solid #eadf9a;
  padding: 8px 0;
  font-size: 13px;
  overflow: hidden;
}
.breaking .container { display: flex; align-items: center; gap: 12px; }
.breaking .tag {
  background: var(--red); color: #fff; padding: 3px 8px; border-radius: 3px;
  font-weight: 800; text-transform: uppercase; font-size: 11px;
  flex-shrink: 0;
}
.ticker { overflow: hidden; flex: 1; white-space: nowrap; position: relative; }
.ticker-track { display: inline-block; padding-left: 100%; animation: ticker 40s linear infinite; }
.ticker-track span { margin-right: 40px; }
.ticker-track a:hover { color: var(--red); }
@keyframes ticker { 0% { transform: translateX(0); } 100% { transform: translateX(-100%); } }

/* Layout */
main { padding: 20px 0 40px; }
.grid { display: grid; gap: 20px; }
.grid.home {
  grid-template-columns: 1fr 320px;
}
@media (max-width: 900px) { .grid.home { grid-template-columns: 1fr; } }

/* Hero */
.hero {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  min-height: 420px;
  background: #222;
}
.hero img { width: 100%; height: 420px; object-fit: cover; }
.hero .overlay {
  position: absolute; inset: 0;
  background: linear-gradient(0deg, rgba(0,0,0,.85) 0%, rgba(0,0,0,.1) 55%, transparent 100%);
}
.hero .caption {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 24px; color: #fff;
}
.hero .caption .cat {
  background: var(--accent-red); color: #fff; padding: 4px 10px; font-size: 11px;
  text-transform: uppercase; font-weight: 800; border-radius: 3px; letter-spacing: 1px;
}
.hero h1 { color: #fff; font-size: 34px; margin: 10px 0 8px; line-height: 1.15; }
.hero p { color: #d9dbe0; margin: 0; font-size: 15px; max-width: 720px; }

/* Sub hero row */
.subhero { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
@media (max-width: 700px) { .subhero { grid-template-columns: 1fr; } }
.subhero .card { position: relative; border-radius: var(--radius); overflow: hidden; min-height: 200px; box-shadow: var(--shadow); }
.subhero .card img { width: 100%; height: 200px; object-fit: cover; }
.subhero .card .caption {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 14px; color: #fff;
  background: linear-gradient(0deg, rgba(0,0,0,.9), rgba(0,0,0,0));
}
.subhero .card h3 { color: #fff; font-size: 17px; margin: 4px 0 0; }
.subhero .card .cat { background: var(--accent-red); color: #fff; padding: 2px 8px; font-size: 10px; text-transform: uppercase; font-weight: 800; border-radius: 3px; }

/* Section headers */
.section-head {
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 3px solid var(--ink);
  padding-bottom: 8px;
  margin: 32px 0 16px;
}
.section-head h2 {
  font-size: 22px; text-transform: uppercase; letter-spacing: 0.5px; margin: 0;
}
.section-head a { color: var(--red); font-weight: 700; font-size: 13px; text-transform: uppercase; }

/* Article cards */
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
@media (max-width: 900px) { .cards { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .cards { grid-template-columns: 1fr; } }
.card {
  background: #fff;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  transition: transform .15s ease, box-shadow .15s ease;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,.08); }
.card .thumb {
  width: 100%; height: 180px; overflow: hidden; background: #eee;
  position: relative;
}
.card .thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s ease; }
.card:hover .thumb img { transform: scale(1.05); }
.card .thumb .cat {
  position: absolute; top: 10px; left: 10px;
  background: var(--accent-red); color: #fff; padding: 3px 8px; font-size: 10px;
  text-transform: uppercase; font-weight: 800; border-radius: 3px; letter-spacing: 0.5px;
}
.card .body { padding: 14px 16px 16px; flex: 1; display: flex; flex-direction: column; }
.card h3 { font-size: 17px; margin: 0 0 8px; }
.card .meta { color: var(--muted); font-size: 12px; margin-top: auto; padding-top: 10px; display: flex; gap: 10px; align-items: center; }
.card .meta .src { font-weight: 700; color: var(--ink-2); }

/* List style (sidebar or wide list) */
.list { display: flex; flex-direction: column; gap: 14px; }
.list .item {
  display: grid; grid-template-columns: 100px 1fr; gap: 12px;
  padding-bottom: 14px; border-bottom: 1px solid var(--line);
}
.list .item:last-child { border-bottom: 0; }
.list .item img { width: 100%; height: 70px; object-fit: cover; border-radius: 4px; }
.list .item h4 { font-size: 14px; margin: 0 0 4px; font-family: var(--font); font-weight: 700; }
.list .item .meta { color: var(--muted); font-size: 11px; }
.list .item .num {
  display: inline-block; background: var(--ink); color: #fff; width: 22px; height: 22px;
  text-align: center; line-height: 22px; border-radius: 50%; font-size: 12px; font-weight: 800;
  margin-right: 6px;
}

/* Sidebar */
.sidebar { display: flex; flex-direction: column; gap: 24px; }
.widget {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.widget h3 {
  background: var(--ink);
  color: #fff;
  padding: 10px 14px;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0;
  font-family: var(--font);
}
.widget .body { padding: 14px; }

/* Newsletter card */
.newsletter {
  background: linear-gradient(135deg, var(--red), var(--red-dark));
  color: #fff;
  padding: 20px;
  border-radius: var(--radius);
  text-align: center;
}
.newsletter h3 { color: #fff; font-size: 20px; margin: 0 0 6px; }
.newsletter p { margin: 0 0 12px; font-size: 13px; opacity: .95; }
.newsletter form { display: flex; gap: 6px; }
.newsletter input {
  flex: 1; border: 0; padding: 10px 12px; border-radius: 4px; font-size: 14px;
}
.newsletter button {
  background: var(--ink); color: #fff; border: 0; padding: 0 16px; font-weight: 700; cursor: pointer; border-radius: 4px;
  text-transform: uppercase; font-size: 12px; letter-spacing: 0.5px;
}
.newsletter .tiny { font-size: 11px; opacity: .8; margin-top: 8px; }

/* Ad slots */
.ad-slot {
  background: #fafafa;
  border: 1px dashed #d1d5db;
  color: #9aa1af;
  text-align: center;
  padding: 24px 12px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  border-radius: var(--radius);
  margin: 20px 0;
}
.ad-slot.leaderboard { min-height: 90px; }
.ad-slot.mpu { min-height: 250px; }
.ad-slot.skyscraper { min-height: 400px; }

/* Article page */
.article-page { display: grid; grid-template-columns: 1fr 320px; gap: 30px; }
@media (max-width: 900px) { .article-page { grid-template-columns: 1fr; } }
.article-body { max-width: 780px; }
.article-body h1 { font-size: 34px; margin: 8px 0 12px; line-height: 1.15; }
.article-body .lede { font-size: 18px; color: var(--ink-2); margin: 0 0 16px; font-weight: 500; }
.article-body .hero-img { width: 100%; border-radius: var(--radius); box-shadow: var(--shadow); margin: 12px 0 6px; }
.article-body .caption-txt { font-size: 12px; color: var(--muted); padding: 6px 0 20px; }
.article-body p { font-size: 16px; margin: 0 0 16px; }
.article-body .kicker {
  display: inline-block; background: var(--accent-red); color: #fff; font-weight: 800; font-size: 11px;
  padding: 4px 10px; border-radius: 3px; text-transform: uppercase; letter-spacing: 1px;
}
.byline { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; padding: 8px 0 12px; border-bottom: 1px solid var(--line); margin-bottom: 20px;}
.byline .author { color: var(--ink); font-weight: 700; }
.share-bar { display: flex; gap: 6px; margin: 20px 0; }
.share-bar a {
  padding: 8px 12px; background: var(--ink); color: #fff; border-radius: 4px; font-size: 12px; font-weight: 700;
}
.share-bar a.fb { background: #1877f2; }
.share-bar a.tw { background: #14171a; }
.share-bar a.wa { background: #25d366; }
.share-bar a.mail { background: #666; }
.source-note {
  background: #f6f7f9; border-left: 4px solid var(--accent-red);
  padding: 12px 16px; margin: 20px 0; font-size: 14px; color: var(--ink-2);
}
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 20px 0; }
.tags a { background: #eef1f5; padding: 4px 10px; font-size: 12px; border-radius: 20px; color: var(--ink-2); }
.tags a:hover { background: var(--red); color: #fff; }

/* Trending strip on article page */
.also-read { margin: 20px 0; }
.also-read h4 { font-size: 14px; text-transform: uppercase; color: var(--red); }

/* Footer */
footer {
  background: var(--ink);
  color: #d7dbe3;
  padding: 40px 0 20px;
  margin-top: 40px;
  font-size: 14px;
}
footer .cols { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 24px; }
@media (max-width: 800px) { footer .cols { grid-template-columns: 1fr 1fr; } }
footer h4 { color: #fff; text-transform: uppercase; font-size: 13px; margin: 0 0 12px; font-family: var(--font); letter-spacing: 1px; }
footer a { display: block; color: #d7dbe3; padding: 3px 0; font-size: 13px; }
footer a:hover { color: #fff; }
footer .bottom { border-top: 1px solid #2a2f3a; margin-top: 24px; padding-top: 16px; text-align: center; font-size: 12px; color: #9aa1af; }

/* Trending numbers list */
.trending-list { counter-reset: t; list-style: none; padding: 0; margin: 0; }
.trending-list li {
  counter-increment: t;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.trending-list li:last-child { border-bottom: 0; }
.trending-list li::before {
  content: counter(t);
  background: var(--accent-red);
  color: #fff;
  width: 26px; height: 26px;
  flex-shrink: 0;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 13px;
}
.trending-list h4 { font-family: var(--font); font-weight: 700; font-size: 14px; margin: 0 0 4px; }
.trending-list .meta { font-size: 11px; color: var(--muted); }

/* Category header */
.cat-header {
  background: var(--ink);
  color: #fff;
  padding: 22px 0;
  margin-bottom: 24px;
}
.cat-header h1 { color: #fff; font-size: 30px; margin: 0 0 4px; }
.cat-header p { color: #b7bcc7; margin: 0; font-size: 14px; }

/* Simple pages (about, privacy, etc.) */
.page-body { max-width: 780px; margin: 0 auto; padding: 20px 0; }
.page-body h1 { font-size: 28px; margin-bottom: 12px; }
.page-body h2 { font-size: 20px; margin: 24px 0 8px; }
.page-body p, .page-body li { font-size: 15px; }

/* Loading / empty state */
.loading, .empty {
  padding: 30px; text-align: center; color: var(--muted); font-size: 14px;
  background: var(--bg-2); border-radius: var(--radius); border: 1px dashed var(--line);
}
.spinner {
  width: 24px; height: 24px; border: 3px solid #eee; border-top: 3px solid var(--red);
  border-radius: 50%; animation: spin 0.8s linear infinite; margin: 0 auto 10px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Back to top */
.back-top {
  position: fixed; bottom: 20px; right: 20px;
  background: var(--red); color: #fff;
  width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; box-shadow: 0 4px 12px rgba(0,0,0,.2);
  opacity: 0; pointer-events: none; transition: opacity .2s;
  border: 0; font-size: 20px;
}
.back-top.show { opacity: 1; pointer-events: auto; }
