/* ToolPilot — clean, fast, readable. No frameworks, no bloat. */
:root {
  --ink: #1a1d21;
  --muted: #5b6470;
  --accent: #4f46e5;
  --accent-soft: #eef0ff;
  --line: #e6e8ec;
  --bg: #ffffff;
  --bg-soft: #f7f8fa;
  --radius: 12px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; overflow-x: hidden; overflow-x: clip; }
img { max-width: 100%; height: auto; }
body {
  margin: 0;
  overflow-x: hidden; overflow-x: clip;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.65;
  font-size: 17px;
}
.wrap { max-width: 760px; margin: 0 auto; padding: 0 20px; }

/* Header */
.site-header { border-bottom: 1px solid var(--line); background: var(--bg); position: sticky; top: 0; z-index: 10; }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; max-width: 960px; }
.brand { font-weight: 800; font-size: 20px; color: var(--ink); text-decoration: none; letter-spacing: -0.02em; }
.brand-mark { color: var(--accent); }
.nav a { margin-left: 20px; color: var(--muted); text-decoration: none; font-size: 15px; }
.nav a:hover { color: var(--ink); }

/* News section on homepage */
.news-section { margin: 44px 0; }
.news-tagline { color: var(--muted); margin: -6px 0 22px; }

/* Newsletter signup */
.newsletter-section {
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  border-radius: 20px;
  padding: 28px 24px;
  margin: 44px 0;
}
.newsletter-section h2 { margin-top: 0; }
.nl-form { display: flex; gap: 10px; margin-top: 18px; }
.nl-form input[type="email"] {
  flex: 1;
  min-width: 0;
  padding: 12px 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 16px;
  font-family: inherit;
  background: #fff;
}
.nl-form .btn { margin-top: 0; white-space: nowrap; }
.nl-note { margin: 12px 0 0; font-size: 14px; }
.nl-note.ok { color: #0d655e; font-weight: 600; }
.nl-note.err { color: #b91c1c; }
@media (max-width: 640px) {
  .nl-form { flex-direction: column; }
  .nl-form .btn { width: 100%; }
}

/* Share buttons */
.share-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 32px 0 8px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
}
.share-row a, .share-row button {
  display: inline-block;
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  background: #fff;
  cursor: pointer;
  font-family: inherit;
}
.share-row a:hover, .share-row button:hover { border-color: var(--accent); color: var(--accent); }

/* Mobile header: stack brand above nav; nav links wrap between items,
   never mid-phrase (no horizontal scrolling needed) */
@media (max-width: 640px) {
  .header-inner {
    flex-direction: column;
    align-items: flex-start;
    height: auto;
    padding-top: 10px;
    padding-bottom: 10px;
    gap: 8px;
  }
  .nav { display: flex; flex-wrap: wrap; gap: 6px 18px; }
  .nav a { margin-left: 0; white-space: nowrap; font-size: 14px; }
}

/* Hero */
.hero { padding: 56px 0 32px; }
.hero-split { display: flex; align-items: center; gap: 32px; padding: 48px 0 36px; }
.hero-copy { flex: 1; min-width: 0; }
.hero-mascot { width: 300px; max-width: 38%; height: auto; border-radius: 24px; flex-shrink: 0; }
.btn { display: inline-block; margin-top: 20px; background: var(--accent); color: #fff; font-weight: 700; padding: 12px 26px; border-radius: 999px; text-decoration: none; font-size: 16px; }
.btn:hover { background: #4338ca; color: #fff; }

/* Affiliate "our pick" box */
.affiliate-box { background: var(--bg-soft); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 12px; padding: 18px 20px; margin: 0 0 28px; }
.affiliate-kicker { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent); margin: 0 0 4px; }
.affiliate-tool { font-size: 21px; font-weight: 800; margin: 0 0 6px; }
.affiliate-blurb { color: var(--muted); margin: 0 0 4px; }
.affiliate-box .btn { margin-top: 10px; }
.affiliate-note { font-size: 12.5px; color: var(--muted); margin: 12px 0 0; }
@media (max-width: 640px) {
  .hero-split { flex-direction: column-reverse; padding: 36px 0 28px; }
  .hero-mascot { width: 220px; max-width: 72%; }
}
.kicker { text-transform: uppercase; letter-spacing: 0.08em; font-size: 13px; font-weight: 700; color: var(--accent); margin: 0 0 8px; }
.breaking-badge {
  display: inline-block; background: #dc2626; color: #fff;
  font-size: 11px; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.08em; padding: 2px 10px; border-radius: 999px;
  margin-right: 6px; vertical-align: 1px;
}
.hero h1 { font-size: clamp(30px, 5vw, 44px); line-height: 1.15; letter-spacing: -0.03em; margin: 0 0 12px; }
.hero-sub { color: var(--muted); font-size: 18px; max-width: 620px; margin: 0; }

h2 { font-size: 24px; letter-spacing: -0.02em; margin: 40px 0 16px; }

/* Cards */
.cards { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 640px) { .cards { grid-template-columns: 1fr 1fr; } }
.card { border: 1px solid var(--line); border-radius: var(--radius); padding: 0; overflow: hidden; text-decoration: none; color: inherit; background: var(--bg); transition: border-color .15s, transform .15s; display: block; }
.card:hover { border-color: var(--accent); transform: translateY(-2px); }
.card-thumb { display: block; aspect-ratio: 16/9; overflow: hidden; background: var(--bg-soft); }
.card-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-body { display: block; padding: 20px; }
.card .card-cat { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent); }
.card h3 { margin: 6px 0 8px; font-size: 18px; line-height: 1.35; letter-spacing: -0.01em; }
.card p { margin: 0; color: var(--muted); font-size: 14.5px; }
.card .card-date { display: block; margin-top: 10px; font-size: 13px; color: var(--muted); }

/* Topics */
.topics { display: flex; flex-wrap: wrap; gap: 10px; }
.topic-chip { background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: 8px 16px; font-size: 14.5px; font-weight: 600; text-decoration: none; }

/* Article */
.post { padding: 32px 0 8px; overflow-wrap: break-word; }
.post h1 { font-size: clamp(28px, 4.5vw, 38px); line-height: 1.2; letter-spacing: -0.025em; margin: 0 0 10px; }
.post .meta { color: var(--muted); font-size: 14px; margin: 0 0 16px; }
.post .lede { font-size: 19px; color: #333a44; border-left: 3px solid var(--accent); padding-left: 16px; margin: 0 0 28px; }
.post h2 { font-size: 24px; margin: 36px 0 12px; letter-spacing: -0.02em; }
.post h3 { font-size: 19px; margin: 28px 0 10px; }
.post p { margin: 0 0 18px; }
.post ul, .post ol { margin: 0 0 18px; padding-left: 24px; }
.post li { margin-bottom: 8px; }
.post table { width: 100%; border-collapse: collapse; margin: 0 0 24px; font-size: 15px; }
.post th, .post td { border: 1px solid var(--line); padding: 10px 12px; text-align: left; overflow-wrap: break-word; }
@media (max-width: 640px) {
  /* Tables become stacked cards: pure vertical scrolling, nothing missed */
  .post table, .post tbody, .post tr, .post td { display: block; width: 100%; }
  .post thead { display: none; }
  .post table { font-size: 15px; }
  .post tr { margin-bottom: 14px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
  .post td { border: none; border-bottom: 1px solid var(--line); padding: 10px 12px; }
  .post td:last-child { border-bottom: none; }
  .post td::before { content: attr(data-label); display: block; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin-bottom: 2px; }
  .post td:first-child { background: var(--bg-soft); font-weight: 700; font-size: 16px; }
  .post td:first-child::before { display: none; }
}
.post th { background: var(--bg-soft); font-weight: 700; }
.post blockquote { border-left: 3px solid var(--line); margin: 0 0 18px; padding: 4px 0 4px 16px; color: var(--muted); }
.post a { color: var(--accent); }

/* Article hero image */
.article-hero { margin: 0 0 28px; border-radius: var(--radius); overflow: hidden; }
.article-hero img { width: 100%; aspect-ratio: 16/9; object-fit: cover; display: block; }

/* Table of contents */
.toc { background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 22px; margin: 0 0 28px; }
.toc .toc-title { font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 0 0 10px; }
.toc ul { list-style: none; padding: 0; margin: 0; }
.toc li { margin-bottom: 6px; }
.toc a { color: var(--ink); text-decoration: none; font-size: 15px; }
.toc a:hover { color: var(--accent); }

/* Related */
.related { border-top: 1px solid var(--line); margin: 32px 0 48px; padding-top: 8px; }.related ul { list-style: none; padding: 0; margin: 0; }
.related li { margin-bottom: 10px; }
.related a { color: var(--ink); font-weight: 600; text-decoration: none; }
.related a:hover { color: var(--accent); }

/* About teaser */
.about-teaser { background: var(--bg-soft); border-radius: var(--radius); padding: 28px; margin: 40px 0 56px; }
.about-teaser h2 { margin-top: 0; }
.about-teaser p { margin-bottom: 0; color: var(--muted); }
.about-teaser a { color: var(--accent); font-weight: 600; }

/* Ad slots — one master switch in engine/build.py (ADS_ENABLED).
   OFF (default): no ad markup is rendered at all — nothing to see, no gaps,
   no layout shift. ON: header leaderboard, article sidebar rail, in-article. */
.ad-slot { margin: 28px auto; text-align: center; }
.ad-slot:empty { display: none; }
.ad-leaderboard { min-height: 0; }

/* Article sidebar placement: single column when ads are off (no .has-sidebar
   class, no aside element) — identical to the pre-ads layout. Two columns
   with a sticky rail only when the switch is on. */
.article-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 32px; }
@media (min-width: 1024px) {
  .article-layout.has-sidebar { grid-template-columns: minmax(0, 1fr) 300px; }
  .ad-sidebar { position: sticky; top: 24px; align-self: start; }
  .ad-sidebar .ad-slot { margin: 0 auto; }
}

/* Footer */
.site-footer { border-top: 1px solid var(--line); background: var(--bg-soft); margin-top: 24px; }
.footer-inner { padding: 32px 20px; max-width: 960px; }
.footer-inner p { margin: 0 0 12px; font-size: 15px; }
.footer-nav a { margin-right: 18px; color: var(--muted); text-decoration: none; font-size: 14px; }
.footer-nav a:hover { color: var(--ink); }
.fine { color: var(--muted); font-size: 13px !important; }
