/* EvenSums - shared stylesheet */
:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --text: #1a222e;
  --muted: #5b6676;
  --border: #e3e7ee;
  --accent: #1f6f5c;
  --accent-hover: #17594a;
  --accent-soft: #e6f2ef;
  --warn-soft: #fdf3e3;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(16, 24, 40, 0.07);
  --max-width: 960px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161c;
    --surface: #1a2029;
    --text: #e8ecf1;
    --muted: #9aa5b3;
    --border: #2a323e;
    --accent: #3fa88e;
    --accent-hover: #57bda3;
    --accent-soft: #1d2f2a;
    --warn-soft: #2e2617;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  }
}

* { box-sizing: border-box; }

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

a { color: var(--accent); }
a:hover { color: var(--accent-hover); }

/* Header */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.site-header .inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.logo {
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--text);
  text-decoration: none;
}
.logo span { color: var(--accent); }
.site-nav { display: flex; gap: 1rem; flex-wrap: wrap; }
.site-nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.92rem;
}
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--accent); }

/* Layout */
main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}
.page-title { margin: 0.5rem 0 0.25rem; font-size: 1.7rem; line-height: 1.25; }
.page-subtitle { margin: 0 0 1.5rem; color: var(--muted); max-width: 46rem; }

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

/* Calculator form */
.calc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}
.field label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
}
.field .hint { font-weight: 400; color: var(--muted); }
.field input, .field select {
  width: 100%;
  padding: 0.55rem 0.7rem;
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
}
.field input:focus, .field select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}
.calc-actions { margin-top: 1.25rem; }
button.primary {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 0.65rem 1.4rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}
button.primary:hover { background: var(--accent-hover); }

/* Results */
.results { margin-top: 1.5rem; }
.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}
.stat {
  background: var(--accent-soft);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
}
.stat .label { font-size: 0.8rem; color: var(--muted); margin-bottom: 0.15rem; }
.stat .value { font-size: 1.35rem; font-weight: 700; }
.chart-wrap { margin-top: 1.25rem; }
canvas.chart { width: 100%; height: auto; }

/* Tables */
.table-wrap { overflow-x: auto; margin-top: 1rem; }
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
table.data th, table.data td {
  text-align: right;
  padding: 0.45rem 0.6rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table.data th:first-child, table.data td:first-child { text-align: left; }
table.data thead th { color: var(--muted); font-weight: 600; }

/* Content sections */
.content h2 { font-size: 1.25rem; margin-top: 2rem; }
.content h3 { font-size: 1.05rem; }
.content p, .content li { color: var(--text); max-width: 46rem; }
.formula {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.75rem 1rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92rem;
  overflow-x: auto;
}

/* Ad slots - replace the inner comment with your ad network tag (see README) */
.ad-slot {
  min-height: 90px;
  margin: 1.5rem 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 0.8rem;
  background: var(--surface);
}
.ad-slot:empty { display: none; }

/* Affiliate / CTA box. Hidden until affiliate links are live; remove the
   display:none override to restore all boxes site-wide. */
.cta-box { display: none; }
.cta-box {
  background: var(--warn-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
}
.cta-box h3 { margin: 0 0 0.35rem; font-size: 1rem; }
.cta-box p { margin: 0 0 0.6rem; font-size: 0.92rem; color: var(--muted); }
.cta-box a.cta-link {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.92rem;
  padding: 0.5rem 1.1rem;
  border-radius: 6px;
}
.cta-box a.cta-link:hover { background: var(--accent-hover); }
.cta-box .disclosure { font-size: 0.75rem; color: var(--muted); margin-top: 0.5rem; }

/* Calculator search (homepage) */
.search-wrap { margin: 0 0 1.5rem; }
#tool-search {
  width: 100%;
  max-width: 480px;
  padding: 0.65rem 0.95rem;
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
}
#tool-search:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}
.no-results { color: var(--muted); }

/* Tool cards on homepage */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}
.tool-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.1rem 1.2rem;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s ease;
}
.tool-card:hover { border-color: var(--accent); color: var(--text); }
.tool-card h2 { margin: 0 0 0.3rem; font-size: 1.05rem; color: var(--accent); }
.tool-card p { margin: 0; font-size: 0.9rem; color: var(--muted); }

/* FAQ */
details.faq {
  border-bottom: 1px solid var(--border);
  padding: 0.6rem 0;
}
details.faq summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.98rem;
}
details.faq p { color: var(--muted); }

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  margin-top: 2rem;
}
.site-footer .inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.5rem 1rem;
  font-size: 0.85rem;
  color: var(--muted);
}
.site-footer nav { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 0.75rem; }
.site-footer a { color: var(--muted); }
.site-footer .disclaimer { max-width: 46rem; }

@media (max-width: 600px) {
  .page-title { font-size: 1.4rem; }
}

/* Cross-promotion banner for the sibling site */
.cross-promo {
  background: var(--accent-soft);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin: 1.5rem 0 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.cross-promo p { margin: 0; font-size: 0.95rem; }
.cross-promo a.promo-btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.92rem;
  padding: 0.5rem 1.1rem;
  border-radius: 6px;
  white-space: nowrap;
}
.cross-promo a.promo-btn:hover { background: var(--accent-hover); }