/* ============================================================
   HaveSaaS — site.css
   Shared stylesheet for havesaas.com
   ============================================================ */

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── BASE ── */
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.7;
  color: #1a1a1a;
  background: #fff;
}

/* ── TOP AD ── */
.ad-banner { text-align: center; padding: 8px 0; background: #f8f8f8; }
.ad-banner img { max-width: 100%; height: auto; display: inline-block; }

/* ── PAGE WRAPPER ── */
.page-wrapper {
  display: flex;
  align-items: flex-start;
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 16px;
  gap: 32px;
}

/* ── SIDEBAR ── */
/*
 * FIX: Sidebar was visually dominating the page because the TOC
 * had no height cap and 26+ items pushed everything else down.
 * Solution:
 *   1. Narrow the sidebar slightly (240px vs 280px).
 *   2. Cap the TOC list at ~320px and make it independently
 *      scrollable so it never overflows the viewport or crowds
 *      the main content.
 *   3. Keep sidebar sticky so the TOC stays accessible while
 *      reading without blocking the article.
 */
.sidebar {
  width: 220px;           /* narrower — was 260-280px */
  min-width: 200px;
  max-width: 240px;
  flex-shrink: 0;
  position: sticky;
  top: 20px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
}

/* TOC widget container */
.toc-widget {
  background: #f4f6f9;
  border: 1px solid #dde2ea;
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 20px;
}

.toc-widget h3 {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #555;
  margin-bottom: 10px;
}

/*
 * KEY FIX: cap the TOC list height and make it scroll internally.
 * 320px ≈ 10–11 visible items — enough context without dominating.
 * Users can scroll within the TOC to see all 26 items.
 */
.toc-nav {
  max-height: 320px;
  overflow-y: auto;
  scrollbar-width: thin;            /* Firefox */
  scrollbar-color: #c5cae9 #f4f6f9; /* Firefox */
}

.toc-nav::-webkit-scrollbar { width: 4px; }
.toc-nav::-webkit-scrollbar-track { background: #f4f6f9; border-radius: 4px; }
.toc-nav::-webkit-scrollbar-thumb { background: #c5cae9; border-radius: 4px; }

.toc-nav ol { list-style: decimal; padding-left: 16px; }
.toc-nav li { margin-bottom: 3px; }
.toc-nav a {
  font-size: 12px;
  color: #1a73e8;
  text-decoration: none;
  line-height: 1.4;
  display: block;
}
.toc-nav a:hover { text-decoration: underline; color: #0d47a1; }

/* Sidebar ad */
.ad-sidebar { text-align: center; margin-bottom: 16px; }
.ad-sidebar img { max-width: 100%; height: auto; border-radius: 6px; }

/* Sidebar promo strip */
.sidebar-promo {
  font-size: 11.5px;
  color: #555;
  background: #fff8e1;
  border: 1px solid #ffe082;
  border-radius: 6px;
  padding: 10px 12px;
  line-height: 1.5;
}
.sidebar-promo a { color: #e65100; font-weight: 600; }

/* ── MAIN CONTENT ── */
.main-content {
  flex: 1;
  min-width: 0;          /* prevents flex overflow */
  max-width: 900px;      /* slightly wider now sidebar is narrower */
}

/* ── ARTICLE HEADER ── */
.article-header { margin-bottom: 28px; border-bottom: 2px solid #e8eaed; padding-bottom: 20px; }
.article-header h1 {
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 800;
  line-height: 1.25;
  color: #111;
  margin-bottom: 10px;
}
.article-meta { font-size: 13px; color: #666; display: flex; gap: 16px; flex-wrap: wrap; }
.article-meta span::before { content: "· "; }
.article-meta span:first-child::before { content: ""; }

/* ── TYPOGRAPHY ── */
.main-content p { margin-bottom: 18px; color: #222; }
.main-content h2 {
  font-size: clamp(1.25rem, 2.5vw, 1.65rem);
  font-weight: 700;
  color: #111;
  margin: 40px 0 14px;
  padding-top: 8px;
  border-top: 3px solid #1a73e8;
}
.main-content h3 {
  font-size: clamp(1.05rem, 2vw, 1.25rem);
  font-weight: 600;
  color: #1a1a1a;
  margin: 28px 0 10px;
}
.main-content ul, .main-content ol { margin: 0 0 18px 24px; }
.main-content li { margin-bottom: 6px; }
.main-content a { color: #1a73e8; text-decoration: none; border-bottom: 1px dotted #1a73e8; }
.main-content a:hover { color: #0d47a1; border-bottom-color: #0d47a1; }
.main-content strong { font-weight: 700; color: #111; }

/* ── INTRO SECTION ── */
.intro-section {
  background: #f0f4ff;
  border-left: 4px solid #1a73e8;
  border-radius: 0 8px 8px 0;
  padding: 20px 24px;
  margin-bottom: 28px;
}
.intro-section p { margin-bottom: 12px; }
.intro-section p:last-child { margin-bottom: 0; }

/* ── ARTICLE IMAGES ── */
.article-image { margin: 28px 0; border-radius: 10px; overflow: hidden; box-shadow: 0 2px 12px rgba(0,0,0,0.08); }
.article-image img { width: 100%; height: auto; display: block; }
.article-image figcaption { font-size: 13px; color: #666; padding: 10px 14px; background: #f8f8f8; font-style: italic; }

/* ── TABLES ── */
.comparison-table, .pricing-table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0 28px;
  font-size: 14px;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.comparison-table th, .pricing-table th {
  background: #1a73e8;
  color: #fff;
  padding: 11px 14px;
  text-align: left;
  font-weight: 600;
  font-size: 13px;
}
.comparison-table td, .pricing-table td {
  padding: 10px 14px;
  border-bottom: 1px solid #e8eaed;
  vertical-align: top;
}
.comparison-table tr:nth-child(even) td,
.pricing-table tr:nth-child(even) td { background: #f8faff; }
.comparison-table tr:last-child td,
.pricing-table tr:last-child td { border-bottom: none; }

/* ── MID / BOTTOM AD BANNERS ── */
.ad-middle, .ad-bottom { margin: 36px 0; text-align: center; }
.ad-middle img, .ad-bottom img { max-width: 100%; height: auto; border-radius: 8px; }

/* ── FAQ ACCORDION ── */
.faq-accordion { margin: 20px 0; }
.faq-item { border: 1px solid #dde2ea; border-radius: 8px; margin-bottom: 10px; overflow: hidden; }
.faq-question {
  width: 100%;
  background: #f4f6f9;
  border: none;
  padding: 14px 18px;
  text-align: left;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  color: #111;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.2s;
}
.faq-question:hover { background: #e8edf5; }
.faq-question::after { content: "+"; font-size: 20px; color: #1a73e8; font-weight: 400; flex-shrink: 0; margin-left: 12px; }
.faq-question[aria-expanded="true"]::after { content: "−"; }
.faq-answer { padding: 16px 18px; background: #fff; border-top: 1px solid #dde2ea; }
.faq-answer p { margin-bottom: 10px; font-size: 14.5px; }
.faq-answer p:last-child { margin-bottom: 0; }

/* ── RESOURCE LISTS ── */
.resource-list { list-style: none; padding: 0; margin: 0 0 20px; }
.resource-list li { padding: 7px 0; border-bottom: 1px solid #f0f0f0; font-size: 14.5px; }
.resource-list li:last-child { border-bottom: none; }
.resource-list a { border-bottom: none; }
.resource-list a::before { content: "→ "; color: #1a73e8; font-weight: 700; }

/* ── AUTHOR BOX ── */
.author-box {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  background: #f8faff;
  border: 1px solid #dde2ea;
  border-radius: 10px;
  padding: 20px 24px;
  margin: 40px 0 20px;
}
.author-avatar img { width: 72px; height: 72px; border-radius: 50%; flex-shrink: 0; object-fit: cover; }
.author-info h3 { font-size: 16px; font-weight: 700; margin-bottom: 6px; }
.author-info p { font-size: 13.5px; color: #444; margin-bottom: 8px; }
.author-info .disclosure { font-size: 12px; color: #888; font-style: italic; }

/* ── FLOATING RIGHT AD ── */
.floating-ad-right {
  position: fixed;
  right: 16px;
  bottom: 80px;
  z-index: 999;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.18);
  padding: 6px;
  max-width: 172px;
}
.floating-ad-right img { width: 160px; height: auto; display: block; border-radius: 6px; }
.floating-ad-close {
  position: absolute;
  top: -10px;
  right: -10px;
  background: #333;
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
  .page-wrapper { flex-direction: column; padding: 16px; gap: 20px; }
  .sidebar { width: 100%; max-width: 100%; min-width: 0; position: static; max-height: none; overflow-y: visible; }
  /* On mobile, TOC collapses to a compact scrollable strip */
  .toc-nav { max-height: 200px; }
  .floating-ad-right { display: none; }
}

@media (max-width: 600px) {
  .article-header h1 { font-size: 1.35rem; }
  .main-content h2 { font-size: 1.15rem; }
  .comparison-table, .pricing-table { font-size: 12px; display: block; overflow-x: auto; }
}
