/* The Ergo Report - Editorial CSS
   Wirecutter-clean, AEO-optimized, mobile-first */

:root {
  --color-text: #1a1a1a;
  --color-text-muted: #555;
  --color-bg: #ffffff;
  --color-bg-alt: #f7f7f5;
  --color-accent: #0a4d4a;
  --color-accent-hover: #063835;
  --color-border: #e5e5e2;
  --color-cta: #c8541a;
  --color-cta-hover: #a13e0d;
  --serif: 'Source Serif Pro', Georgia, serif;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --max-width: 1240px;
  --content-width: 880px;
}

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  color: var(--color-text);
  background: var(--color-bg);
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* HEADER */
.site-header {
  border-bottom: 1px solid var(--color-border);
  padding: 18px 0;
  position: sticky;
  top: 0;
  background: var(--color-bg);
  z-index: 100;
}
.site-header .container { display: flex; justify-content: space-between; align-items: center; gap: 24px; }
.logo {
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 700;
  color: var(--color-text);
  text-decoration: none;
  letter-spacing: -0.02em;
}
.primary-nav { display: flex; gap: 28px; }
.primary-nav a {
  color: var(--color-text);
  text-decoration: none;
  font-weight: 500;
  font-size: 15px;
}
.primary-nav a:hover { color: var(--color-accent); }

/* MAIN */
main.container { padding-top: 32px; padding-bottom: 64px; }

/* TYPOGRAPHY */
h1, h2, h3, h4 {
  font-family: var(--serif);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin-top: 1.5em;
  margin-bottom: 0.5em;
}
h1 { font-size: 42px; margin-top: 0; }
h2 { font-size: 28px; }
h3 { font-size: 22px; }
h4 { font-size: 18px; font-family: var(--sans); }
p { margin-bottom: 1em; }
a { color: var(--color-accent); }
a:hover { color: var(--color-accent-hover); }
ul, ol { margin: 0 0 1em 1.5em; }
ul li, ol li { margin-bottom: 0.4em; }

/* CONTENT WIDTH SYSTEM
   - Container: 1240px max, centered (fills more of wide screens, no left-stuck feel)
   - Hub pages: text sections fill the container width (no narrow column)
   - Article pages: text sections constrained to 880px centered for readability
*/

/* Article body stays narrow + centered for editorial reading */
article.article-page,
.article-body,
.text-narrow {
  max-width: var(--content-width);
  margin-left: auto;
  margin-right: auto;
}

/* Hero blocks centered in full container */
.hero {
  max-width: 920px;
  margin-left: auto;
  margin-right: auto;
}

/* Everything else (hubs, sections, tables, cards, grids) fills the full container width */
article.hub-page,
.hub-header,
.hub-intro,
.tldr,
.tldr-box,
.key-stats,
.methodology,
.faq,
.related-articles,
.hub-callbacks,
.data-sources,
.article-header,
.comparison-table,
.rankings,
.hub-grid,
.stats-band,
.mini-list-products,
.product-card,
.mini-list,
section.full-width {
  max-width: 100%;
}

/* HERO ON HUB / ARTICLE */
.hub-header, .article-header { margin-bottom: 32px; padding-bottom: 24px; border-bottom: 1px solid var(--color-border); }
.hub-tagline, .article-meta {
  color: var(--color-text-muted);
  font-size: 15px;
  margin-bottom: 8px;
}
.hub-updated { color: var(--color-text-muted); font-size: 13px; }
.article-meta .author { font-weight: 600; color: var(--color-text); }

/* TLDR / KEY STATS */
.tldr, .tldr-box {
  background: var(--color-bg-alt);
  border-left: 4px solid var(--color-accent);
  padding: 20px 24px;
  margin: 24px 0;
  border-radius: 0 4px 4px 0;
}
.tldr h2, .tldr-box h2 { margin-top: 0; font-size: 14px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--color-accent); font-family: var(--sans); }
.key-stats { background: #fffdf5; border-left: 4px solid var(--color-cta); padding: 20px 24px; margin: 24px 0; }
.key-stats h2 { margin-top: 0; font-size: 14px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--color-cta); font-family: var(--sans); }
.stat-source { color: var(--color-text-muted); font-size: 13px; font-weight: 400; }

/* COMPARISON TABLE */
.comparison-table { margin: 32px 0; overflow-x: auto; }
.comparison-table table { width: 100%; border-collapse: collapse; font-size: 15px; }
.comparison-table th { text-align: left; padding: 12px; background: var(--color-bg-alt); border-bottom: 2px solid var(--color-border); font-weight: 600; }
.comparison-table td { padding: 14px 12px; border-bottom: 1px solid var(--color-border); }
.comparison-table tbody tr:hover { background: var(--color-bg-alt); }

/* PRODUCT CARDS */
.product-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 32px;
  margin-bottom: 32px;
  position: relative;
}
.product-card-header { margin-bottom: 16px; }
.rank-badge {
  display: inline-block;
  background: var(--color-accent);
  color: white;
  padding: 4px 12px;
  border-radius: 16px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--sans);
  margin-bottom: 8px;
}

/* Editorial pick badges - top-right corner of card */
.pick-badge {
  position: absolute;
  top: -10px;
  right: 24px;
  padding: 6px 16px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-family: var(--sans);
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}
.pick-our { background: #c8541a; color: white; }
.pick-budget { background: #2d6a4f; color: white; }
.pick-premium { background: #1a1a2e; color: white; }
.pick-runner { background: #5a5a6e; color: white; }

.product-card h2 { margin-top: 8px; font-size: 26px; }
.product-angle { color: var(--color-text-muted); font-size: 15px; font-style: italic; }
.product-card-body { display: grid; grid-template-columns: 320px 1fr; gap: 32px 32px; align-items: start; }
/* Features and review sections span the FULL CARD WIDTH below the image+meta row.
   Without this, they fall into column 1 row 2 and visually "cling left" with empty space right. */
.product-features, .product-review { grid-column: 1 / -1; }
.product-features h3, .product-review h3 { margin-top: 8px; }
.product-image img { max-width: 100%; height: auto; border-radius: 4px; max-height: 320px; object-fit: contain; }

/* Brand placeholder card (for direct-brand products with no image) */
.brand-placeholder {
  background: linear-gradient(135deg, var(--color-bg-alt) 0%, #ffffff 100%);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  height: 240px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px;
}
.brand-placeholder .brand-name {
  font-family: var(--serif);
  font-size: 32px;
  font-weight: 700;
  color: var(--color-accent);
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}
.brand-placeholder .brand-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--color-text-muted);
}

.product-meta { font-size: 15px; }
.product-price { font-size: 28px; font-weight: 700; color: var(--color-text); margin-bottom: 8px; font-family: var(--serif); }
.product-rating { color: var(--color-text-muted); margin-bottom: 16px; font-size: 15px; }
.product-rating .stars { color: #f5a623; font-size: 17px; letter-spacing: 1px; }
.product-features ul { font-size: 15px; margin-left: 1.2em; }
.product-features li { margin-bottom: 6px; }

/* CTA BUTTONS */
.cta, a.cta-amazon, a.cta-direct {
  display: inline-block;
  background: var(--color-cta);
  color: white !important;
  padding: 12px 24px;
  border-radius: 4px;
  text-decoration: none;
  font-weight: 600;
  font-size: 15px;
  margin: 8px 0;
  transition: background 0.15s;
}
.cta:hover, a.cta-amazon:hover, a.cta-direct:hover { background: var(--color-cta-hover); color: white !important; text-decoration: none; }

/* MINI-LIST IN ARTICLES */
.mini-list { margin: 40px 0; padding: 28px; background: var(--color-bg-alt); border-radius: 8px; }
.mini-list-products { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; margin-top: 20px; }
.mini-product-card { background: white; border: 1px solid var(--color-border); border-radius: 6px; padding: 16px; }
.mini-product-card img { max-width: 100%; height: auto; max-height: 140px; object-fit: contain; }
.mini-product-card h3 { font-size: 16px; margin: 12px 0 6px; }
.mini-product-price { font-weight: 600; font-size: 16px; margin-bottom: 4px; }
.mini-product-angle { font-size: 13px; color: var(--color-text-muted); margin-bottom: 12px; }
.mini-cta { font-size: 14px; padding: 8px 14px; }

/* FAQ */
.faq { margin: 40px 0; }
.faq details { border: 1px solid var(--color-border); border-radius: 6px; margin-bottom: 12px; padding: 16px 20px; }
.faq summary { font-weight: 600; cursor: pointer; font-family: var(--serif); font-size: 18px; }
.faq-answer { margin-top: 12px; color: var(--color-text-muted); }

/* HUB CALLBACKS */
.hub-callbacks { margin: 32px 0; padding: 24px; background: var(--color-bg-alt); border-radius: 8px; }
.hub-callbacks ul { list-style: none; margin: 16px 0 0 0; }
.hub-callbacks li { font-size: 16px; margin-bottom: 10px; }

/* DATA SOURCES */
.data-sources { margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--color-border); font-size: 14px; color: var(--color-text-muted); }
.data-sources ul { margin-left: 1.2em; }

/* HOMEPAGE HUB GRID */
.hub-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 24px; margin: 40px 0; }
.hub-card { background: var(--color-bg); border: 1px solid var(--color-border); border-radius: 8px; padding: 24px; transition: transform 0.15s, border-color 0.15s; text-decoration: none; color: inherit; display: block; }
.hub-card:hover { transform: translateY(-2px); border-color: var(--color-accent); }
.hub-card h3 { font-size: 20px; margin-top: 0; margin-bottom: 8px; }
.hub-card p { color: var(--color-text-muted); font-size: 14px; margin-bottom: 0; }

/* BREADCRUMBS */
.breadcrumbs { font-size: 13px; color: var(--color-text-muted); margin-bottom: 16px; }
.breadcrumbs a { color: var(--color-text-muted); }

/* FOOTER */
.site-footer {
  background: var(--color-bg-alt);
  padding: 40px 0;
  margin-top: 80px;
  border-top: 1px solid var(--color-border);
  font-size: 14px;
  color: var(--color-text-muted);
}
.site-footer p { margin-bottom: 12px; max-width: 100%; }
.affiliate-disclosure, .medical-disclaimer { font-size: 13px; line-height: 1.5; }
.footer-nav { display: flex; flex-wrap: wrap; gap: 18px; margin: 16px 0; }
.footer-nav a { color: var(--color-text-muted); text-decoration: none; font-size: 13px; }
.footer-nav a:hover { color: var(--color-accent); }
.copyright { font-size: 12px; }

/* ARTICLE BODY */
.article-body { max-width: var(--content-width); font-size: 18px; line-height: 1.7; }
.article-body h2, .article-body h3 { font-family: var(--serif); }
.article-body img { max-width: 100%; height: auto; margin: 24px 0; border-radius: 4px; }
.article-body blockquote { border-left: 4px solid var(--color-accent); padding-left: 20px; margin: 24px 0; color: var(--color-text-muted); font-style: italic; }
.article-body code { background: var(--color-bg-alt); padding: 2px 6px; border-radius: 3px; font-size: 0.9em; }
.hero-image { width: 100%; max-height: 480px; object-fit: cover; border-radius: 6px; margin: 24px 0; }

/* MOBILE */
@media (max-width: 720px) {
  .container { padding: 0 16px; }
  h1 { font-size: 32px; }
  h2 { font-size: 24px; }
  body { font-size: 16px; }
  .product-card-body { grid-template-columns: 1fr; }
  .product-image img { max-width: 200px; }
  .primary-nav { gap: 18px; font-size: 14px; }
  .comparison-table { font-size: 13px; }
  .comparison-table th, .comparison-table td { padding: 10px 8px; }
  .article-body { font-size: 17px; }
}

/* PRINT */
@media print {
  .site-header, .site-footer, .cta { display: none; }
}
