:root {
  --bg: #f8fafc;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --accent: #6366f1;
  --ad-bg: #f1f5f9;
  --ad-border: #cbd5e1;
}

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

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

.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Header */
.site-header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.logo { font-size: 1.4rem; font-weight: 800; color: var(--text); text-decoration: none; }
.logo span { color: var(--accent); }
.main-nav a { color: var(--muted); font-weight: 500; margin-left: 18px; font-size: 0.95rem; }
.main-nav a:hover, .main-nav a.active { color: var(--accent); text-decoration: none; }

/* Hero */
.hero { text-align: center; padding: 44px 0 28px; }
.hero h1 { font-size: 2.1rem; letter-spacing: -0.02em; }
.hero p { color: var(--muted); margin-top: 6px; }

/* Layout */
.content-layout { display: grid; grid-template-columns: 1fr 300px; gap: 32px; padding-bottom: 60px; }

/* Posts */
.post {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  transition: box-shadow 0.15s, transform 0.15s;
}
.post:hover { box-shadow: 0 6px 20px rgba(0,0,0,0.07); transform: translateY(-2px); }
.post-image { height: 140px; display: flex; align-items: center; justify-content: center; font-size: 3rem; }
.post-body { padding: 16px; }
.post-meta { font-size: 0.8rem; color: var(--muted); margin-bottom: 6px; }
.post h2, .post h3 { line-height: 1.35; letter-spacing: -0.01em; }
.post h2 { font-size: 1.5rem; }
.post h3 { font-size: 1.1rem; }
.post h2 a, .post h3 a { color: var(--text); }
.post h2 a:hover, .post h3 a:hover { color: var(--accent); text-decoration: none; }
.excerpt { color: var(--muted); font-size: 0.92rem; margin-top: 8px; }
.post-source { font-size: 0.8rem; color: var(--muted); margin-top: 10px; }

.post.featured { display: grid; grid-template-columns: 1fr 1.2fr; margin-bottom: 24px; }
.post.featured .post-image { height: 100%; min-height: 220px; font-size: 5rem; }

.post-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 28px; }

/* Tags */
.tag {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 0.72rem; font-weight: 700; color: #fff; text-transform: uppercase; letter-spacing: 0.03em;
}
.tag.ai { background: #8b5cf6; }
.tag.startups { background: #0ea5e9; }
.tag.gadgets { background: #f59e0b; }
.tag.dev { background: #10b981; }

/* Headline lists */
.section-title { font-size: 1.25rem; margin: 30px 0 12px; padding-bottom: 8px; border-bottom: 2px solid var(--border); }
.headline-list { list-style: none; }
.headline-list li {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 4px; border-bottom: 1px solid var(--border); font-size: 0.95rem;
}
.headline-list .time { margin-left: auto; color: var(--muted); font-size: 0.8rem; flex-shrink: 0; }
.headline-list a { color: var(--text); font-weight: 500; }
.headline-list a:hover { color: var(--accent); text-decoration: none; }

/* Sidebar */
.sidebar .widget {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; padding: 18px; margin-top: 20px;
}
.widget h4 { margin-bottom: 10px; font-size: 1rem; }
.trending { padding-left: 18px; }
.trending li { margin-bottom: 8px; font-size: 0.9rem; }
.trending a { color: var(--text); }
.trending a:hover { color: var(--accent); text-decoration: none; }

.newsletter input {
  width: 100%; padding: 10px; margin-top: 10px;
  border: 1px solid var(--border); border-radius: 8px; font-size: 0.9rem;
}
.newsletter button {
  width: 100%; margin-top: 8px; padding: 10px;
  background: var(--accent); color: #fff; border: none; border-radius: 8px;
  font-weight: 600; cursor: pointer;
}
.newsletter button:hover { opacity: 0.9; }
.newsletter p { color: var(--muted); font-size: 0.88rem; }

.load-more {
  display: block; width: 100%; margin-top: 24px; padding: 12px;
  background: var(--card); border: 1px solid var(--border); border-radius: 10px;
  font-weight: 600; color: var(--accent); cursor: pointer;
}
.load-more:hover { border-color: var(--accent); }

/* ===== AD SLOTS — styling for placeholders =====
   These .ad-slot containers are where your ad network code goes.
   Once real ad code is pasted in, hide the placeholder visuals
   by adding the class "ad-loaded" to the container from your script,
   or just delete the inner .ad-placeholder div. */
.ad-slot {
  position: relative;
  background: var(--ad-bg);
  border: 1px dashed var(--ad-border);
  border-radius: 8px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center;
  overflow: hidden;
}
.ad-label {
  position: absolute; top: 4px; left: 8px;
  font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--muted);
}
.ad-placeholder { color: #94a3b8; font-size: 0.85rem; padding: 20px; }

.ad-banner { min-height: 90px; margin: 18px auto; max-width: 1100px; }
.ad-infeed { min-height: 90px; margin: 22px 0; }
.ad-sidebar { min-height: 250px; margin-bottom: 4px; }
.ad-sticky { position: sticky; top: 80px; }
.ad-inarticle { min-height: 280px; margin: 26px 0; }

/* Sticky anchor ad at bottom of viewport */
.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); border-radius: 6px;
  cursor: pointer; padding: 2px 8px; color: var(--muted);
}
body { padding-bottom: 50px; } /* clears the anchor ad */

/* Article page */
.article-page { max-width: 760px; padding-top: 30px; padding-bottom: 60px; }
.article-full h1 { font-size: 2rem; line-height: 1.25; margin: 10px 0 18px; letter-spacing: -0.02em; }
.article-hero { height: 320px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 6rem; margin-bottom: 24px; }
.article-content p { margin-bottom: 18px; }
.article-content h2 { margin: 26px 0 10px; font-size: 1.35rem; }
.lede { font-size: 1.15rem; color: var(--muted); }
.related { margin-top: 40px; }
.related h3 { margin-bottom: 10px; }

/* Simple pages (about/privacy/terms/contact) */
.page { max-width: 760px; padding: 40px 20px 80px; }
.page h1 { margin-bottom: 16px; }
.page h2 { margin: 26px 0 10px; }
.page p { margin-bottom: 14px; color: #334155; }

/* Footer */
.site-footer { background: var(--card); border-top: 1px solid var(--border); padding: 36px 0 20px; margin-top: 20px; }
.footer-inner { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 20px; }
.footer-tag { color: var(--muted); font-size: 0.85rem; margin-top: 6px; }
.footer-links a { display: block; color: var(--muted); font-size: 0.9rem; margin-bottom: 6px; }
.footer-links a:hover { color: var(--accent); }
.footer-bottom { margin-top: 26px; padding-top: 16px; border-top: 1px solid var(--border); color: var(--muted); font-size: 0.8rem; }

/* Responsive */
@media (max-width: 900px) {
  .content-layout { grid-template-columns: 1fr; }
  .post.featured { grid-template-columns: 1fr; }
  .post.featured .post-image { min-height: 160px; }
  .ad-sticky { position: static; }
}
@media (max-width: 620px) {
  .post-grid { grid-template-columns: 1fr; }
  .main-nav a { margin-left: 12px; font-size: 0.85rem; }
  .hero h1 { font-size: 1.6rem; }
}
