/* ==========================================================
   TechPulse — classic news-aggregator theme
   ========================================================== */

:root {
  --bg: #ffffff;
  --bg-alt: #f5f5f5;
  --text: #1a1a1a;
  --muted: #6b6b6b;
  --border: #e2e2e2;
  --accent: #e8420e;      /* news-style red-orange */
  --accent-dark: #c23509;
  --link: #0b5fa5;
  --topbar: #1c1c1c;
  --nav: #262626;
  --src-tf: #d63b13;
  --src-gnn: #1e7e34;
  --ad-bg: #f7f7f7;
  --ad-border: #d9d9d9;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  font-size: 16px;
}

.container { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }

/* ---------- Top bar ---------- */
.topbar { background: var(--topbar); color: #cfcfcf; font-size: 0.78rem; }
.topbar-inner { display: flex; justify-content: space-between; align-items: center; height: 34px; }
.topbar-links a { color: #cfcfcf; margin-left: 16px; }
.topbar-links a:hover { color: #fff; }

/* ---------- Header ---------- */
.site-header { border-bottom: 1px solid var(--border); background: #fff; }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding-top: 18px; padding-bottom: 18px; }
.logo { display: flex; align-items: baseline; gap: 8px; text-decoration: none !important; flex-wrap: wrap; }
.logo-mark { font-size: 1.9rem; }
.logo-text { font-size: 2.1rem; font-weight: 800; letter-spacing: -1px; color: var(--text); }
.logo-text em { font-style: normal; color: var(--accent); }
.logo-tag { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 1.2px; width: 100%; margin-left: 2px; }
.header-ad { flex-shrink: 0; }

/* ---------- Nav ---------- */
.main-nav { background: var(--nav); border-bottom: 3px solid var(--accent); }
.nav-inner { display: flex; align-items: center; }
.nav-toggle { display: none; background: none; border: none; color: #fff; font-size: 1.4rem; cursor: pointer; padding: 8px 4px; }
.nav-links { display: flex; flex-wrap: wrap; }
.nav-links a {
  color: #ddd; font-weight: 600; font-size: 0.88rem; text-transform: uppercase;
  letter-spacing: 0.4px; padding: 12px 18px; text-decoration: none !important;
  border-right: 1px solid #3a3a3a;
}
.nav-links a:first-child { border-left: 1px solid #3a3a3a; }
.nav-links a:hover { background: #333; color: #fff; }
.nav-links a.active { background: var(--accent); color: #fff; }

/* ---------- Layout ---------- */
.layout { display: grid; grid-template-columns: 1fr 330px; gap: 28px; padding-top: 24px; padding-bottom: 50px; }

/* ---------- Featured story ---------- */
.story-featured { border: 1px solid var(--border); margin-bottom: 26px; background: #fff; }
.story-featured .story-img { height: 320px; }
.story-featured .story-body { padding: 20px 22px 22px; }
.story-featured h2 { font-size: 1.7rem; line-height: 1.25; letter-spacing: -0.4px; margin: 8px 0 10px; }
.story-featured .excerpt { font-size: 1.02rem; color: #444; }

/* ---------- Story list ---------- */
.story {
  display: grid; grid-template-columns: 190px 1fr; gap: 18px;
  padding: 18px 0; border-bottom: 1px solid var(--border);
}
.story-img {
  width: 100%; height: 120px; object-fit: cover; display: block;
  background: var(--bg-alt);
}
.story-img.placeholder {
  display: flex; align-items: center; justify-content: center;
  font-size: 2.4rem; background: linear-gradient(135deg, #ececec, #dcdcdc);
}
.story h2 { font-size: 1.12rem; line-height: 1.35; letter-spacing: -0.2px; margin: 6px 0 6px; }
.story h2 a { color: var(--text); }
.story h2 a:hover { color: var(--accent); }
.story .excerpt { color: #555; font-size: 0.92rem; }
.story-meta { display: flex; align-items: center; gap: 8px; font-size: 0.74rem; color: var(--muted); flex-wrap: wrap; }

/* Source badges */
.src-badge {
  display: inline-block; padding: 2px 8px; border-radius: 3px;
  font-size: 0.68rem; font-weight: 700; color: #fff; text-transform: uppercase; letter-spacing: 0.5px;
}
.full-badge {
  display: inline-block; padding: 2px 7px; border-radius: 3px;
  font-size: 0.62rem; font-weight: 800; letter-spacing: 0.5px;
  color: #1e7e34; border: 1px solid #1e7e34; background: #f0fff4;
}
.src-badge.tf { background: var(--src-tf); }
.src-badge.gnn { background: var(--src-gnn); }
.cat-label { text-transform: uppercase; font-weight: 600; letter-spacing: 0.4px; }
.read-link { color: var(--accent); font-weight: 600; font-size: 0.8rem; }
.read-link:hover { color: var(--accent-dark); }

/* Feed section header */
.feed-head {
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 3px solid var(--text); margin-bottom: 4px; padding-bottom: 6px;
}
.feed-head h1, .feed-head h2 { font-size: 1.15rem; text-transform: uppercase; letter-spacing: 0.5px; }
.feed-stamp { font-size: 0.74rem; color: var(--muted); }

.feed-controls { text-align: center; margin: 26px 0 10px; }
.load-more {
  background: var(--text); color: #fff; border: none; padding: 12px 34px;
  font-size: 0.88rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px;
  cursor: pointer;
}
.load-more:hover { background: var(--accent); }
.load-more:disabled { background: #bbb; cursor: default; }

/* ---------- Sidebar ---------- */
.sidebar { display: flex; flex-direction: column; gap: 22px; }
.widget { border: 1px solid var(--border); padding: 16px 18px; background: #fff; }
.widget-title {
  font-size: 0.92rem; text-transform: uppercase; letter-spacing: 0.6px;
  border-bottom: 2px solid var(--accent); padding-bottom: 8px; margin-bottom: 12px;
}
.widget-more { font-size: 0.82rem; font-weight: 600; }
.about-widget p { font-size: 0.88rem; color: #555; margin-bottom: 8px; }

.popular-list { list-style: none; counter-reset: pop; }
.popular-list li { counter-increment: pop; padding: 10px 0 10px 34px; border-bottom: 1px solid var(--border); position: relative; }
.popular-list li:last-child { border-bottom: none; }
.popular-list li::before {
  content: counter(pop); position: absolute; left: 0; top: 10px;
  width: 24px; height: 24px; background: var(--accent); color: #fff;
  font-size: 0.76rem; font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.popular-list a { color: var(--text); font-size: 0.87rem; font-weight: 600; line-height: 1.35; display: block; }
.popular-list a:hover { color: var(--accent); }

.source-list { list-style: none; }
.source-list li { padding: 9px 0; border-bottom: 1px solid var(--border); }
.source-list li:last-child { border-bottom: none; }
.source-list a { font-weight: 700; font-size: 0.9rem; }
.source-list span { display: block; font-size: 0.78rem; color: var(--muted); }

.newsletter p { font-size: 0.87rem; color: #555; margin-bottom: 10px; }
.newsletter input { width: 100%; padding: 10px; border: 1px solid var(--border); font-size: 0.88rem; }
.newsletter button {
  width: 100%; margin-top: 8px; padding: 10px; background: var(--accent);
  color: #fff; border: none; font-weight: 700; cursor: pointer; font-size: 0.88rem;
}
.newsletter button:hover { background: var(--accent-dark); }

/* ---------- AD SLOTS ---------- */
.ad-slot {
  position: relative; background: var(--ad-bg); border: 1px dashed var(--ad-border);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; overflow: hidden; min-height: 90px;
}
.ad-label {
  position: absolute; top: 4px; left: 8px; font-size: 0.6rem;
  text-transform: uppercase; letter-spacing: 0.08em; color: #9a9a9a;
}
.ad-placeholder { color: #a5a5a5; font-size: 0.82rem; padding: 16px; }
.ad-square { min-height: 250px; margin-bottom: 2px; }
.ad-rect { min-height: 90px; margin-top: 24px; }

.ad-anchor {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 60; min-height: 50px;
  border-radius: 0; border-left: none; border-right: none; border-bottom: none;
}
.anchor-close {
  position: absolute; right: 8px; top: 8px; background: #fff;
  border: 1px solid var(--border); cursor: pointer; padding: 2px 8px; color: var(--muted);
}
body { padding-bottom: 50px; }

/* ---------- Footer ---------- */
.site-footer { background: var(--topbar); color: #b5b5b5; margin-top: 30px; padding: 40px 0 0; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 30px; padding-bottom: 30px; }
.footer-logo .logo-text { color: #fff; font-size: 1.4rem; }
.footer-desc { font-size: 0.82rem; margin-top: 10px; line-height: 1.6; }
.site-footer h4 { color: #fff; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.6px; margin-bottom: 12px; }
.site-footer a { display: block; color: #b5b5b5; font-size: 0.85rem; margin-bottom: 7px; }
.site-footer a:hover { color: #fff; }
.footer-bottom { border-top: 1px solid #333; padding-top: 16px; padding-bottom: 20px; font-size: 0.76rem; color: #8a8a8a; }

/* ---------- Static pages ---------- */
.page { max-width: 780px; padding: 36px 16px 70px; }
.page h1 { font-size: 1.8rem; margin-bottom: 14px; letter-spacing: -0.5px; }
.page h2 { font-size: 1.15rem; margin: 24px 0 8px; }
.page p, .page li { color: #3a3a3a; margin-bottom: 12px; }
.page ul { padding-left: 22px; }
.noscript { padding: 20px; background: var(--bg-alt); }

/* ---------- On-site article page (post.html) ---------- */
.breadcrumb { font-size: 0.78rem; color: var(--muted); margin-bottom: 14px; }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--accent); }
.article-meta { margin-bottom: 8px; }
.article-title { font-size: 2rem; line-height: 1.2; letter-spacing: -0.6px; margin-bottom: 12px; }
.article-byline { font-size: 0.85rem; color: var(--muted); padding-bottom: 16px; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.article-hero { width: 100%; max-height: 430px; object-fit: cover; display: block; margin-bottom: 20px; }
.article-excerpt p { font-size: 1.06rem; color: #333; margin-bottom: 18px; }

/* Full article body (licensed/public-domain sources) */
.article-body { font-size: 1.02rem; color: #2a2a2a; }
.article-body p { margin-bottom: 16px; }
.article-body h2 { font-size: 1.3rem; margin: 26px 0 10px; letter-spacing: -0.3px; }
.article-body h3 { font-size: 1.1rem; margin: 22px 0 8px; }
.article-body ul, .article-body ol { margin: 0 0 16px 22px; }
.article-body li { margin-bottom: 6px; }
.article-body blockquote {
  border-left: 4px solid var(--accent); padding: 8px 0 8px 16px;
  margin: 0 0 16px; color: #555; font-style: italic;
}
.article-body img { width: 100%; height: auto; display: block; margin: 18px 0 6px; }
.article-body figcaption { font-size: 0.8rem; color: var(--muted); margin: -12px 0 18px; }

.license-note {
  background: #fffbe8; border: 1px solid #e8dfa0; padding: 10px 14px;
  font-size: 0.8rem; color: #6b6234; margin: 20px 0;
}

.continue-box {
  background: var(--bg-alt); border: 1px solid var(--border);
  padding: 20px 22px; margin: 24px 0; text-align: center;
}
.continue-note { font-size: 0.85rem; color: var(--muted); margin-bottom: 14px; }
.continue-btn {
  display: inline-block; background: var(--accent); color: #fff !important;
  padding: 13px 30px; font-weight: 700; font-size: 0.95rem; text-decoration: none !important;
}
.continue-btn:hover { background: var(--accent-dark); }

.related { margin-top: 34px; }
.story-thumb-link { display: block; }

/* ---------- Live ad units (mounted by ads.js) ---------- */
.ad-live { border: 0 !important; background: transparent !important; min-height: 0 !important; display: block; }
.ad-frame { display: block; margin: 0 auto; border: 0; max-width: 100%; }
.ad-slot.page-ad { margin: 18px auto; max-width: 100%; min-height: 0; border: 0; background: transparent; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .layout { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .header-ad { display: none; }
}
@media (max-width: 640px) {
  .story { grid-template-columns: 120px 1fr; gap: 12px; }
  .story-img { height: 84px; }
  .story-featured .story-img { height: 200px; }
  .story h2 { font-size: 1rem; }
  .nav-toggle { display: block; }
  .nav-links { display: none; width: 100%; flex-direction: column; }
  .nav-links.open { display: flex; }
  .nav-links a { border: none; border-bottom: 1px solid #3a3a3a; }
  .footer-grid { grid-template-columns: 1fr; }
}
