/* TallyUp Tools — shared stylesheet (vanilla CSS, zero dependencies) */
:root {
  --bg: #f7f9fc;
  --surface: #ffffff;
  --ink: #16222e;
  --muted: #5a6b7e;
  --line: #e3e9f1;
  --brand: #0e7c66;
  --brand-dark: #0a5f4e;
  --brand-soft: #e6f4f0;
  --accent: #f59e0b;
  --danger: #b42318;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(16, 34, 46, .08), 0 6px 20px rgba(16, 34, 46, .06);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --max: 1060px;
  --max-narrow: 760px;
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.65;
  font-size: 1.0625rem;
}

img, table { max-width: 100%; }

/* ---------- layout ---------- */
.container { max-width: var(--max); margin: 0 auto; padding: 0 1.25rem; }
.container-narrow { max-width: var(--max-narrow); margin: 0 auto; padding: 0 1.25rem; }

/* ---------- header ---------- */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 50;
}
.site-header .container {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding-top: .8rem; padding-bottom: .8rem;
}
.brand { font-weight: 800; font-size: 1.35rem; color: var(--ink); text-decoration: none; letter-spacing: -.01em; }
.brand span { color: var(--brand); }
.site-nav { display: flex; gap: 1.1rem; flex-wrap: wrap; }
.site-nav a { color: var(--muted); text-decoration: none; font-weight: 600; font-size: .98rem; }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--brand-dark); }

/* ---------- hero ---------- */
.hero {
  background: linear-gradient(180deg, var(--brand-soft), var(--bg));
  padding: 3rem 0 2.5rem;
  border-bottom: 1px solid var(--line);
}
.hero h1 { font-size: clamp(1.9rem, 4.5vw, 2.7rem); line-height: 1.15; margin: 0 0 .6rem; letter-spacing: -.02em; }
.hero p.lede { font-size: 1.15rem; color: var(--muted); max-width: 42rem; margin: 0 0 1.4rem; }
.hero .badges { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: 1rem; }
.badge {
  display: inline-block; background: var(--surface); border: 1px solid var(--line);
  border-radius: 999px; padding: .25rem .8rem; font-size: .85rem; font-weight: 600; color: var(--muted);
}

/* ---------- cards & grids ---------- */
.section { padding: 2.5rem 0; }
.section h2 { font-size: 1.55rem; margin: 0 0 .4rem; letter-spacing: -.01em; }
.section .sub { color: var(--muted); margin: 0 0 1.5rem; max-width: 46rem; }

.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.1rem; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.4rem; box-shadow: var(--shadow); text-decoration: none; color: inherit;
  display: flex; flex-direction: column; gap: .5rem;
  transition: transform .12s ease, box-shadow .12s ease;
}
a.card:hover { transform: translateY(-2px); box-shadow: 0 4px 10px rgba(16,34,46,.1), 0 10px 28px rgba(16,34,46,.08); }
.card h3 { margin: 0; font-size: 1.12rem; color: var(--brand-dark); }
.card p { margin: 0; color: var(--muted); font-size: .97rem; }
.card .tag { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--brand); }

.breadcrumbs { font-size: .88rem; color: var(--muted); margin: 1.2rem 0 .4rem; }
.breadcrumbs a { color: var(--brand-dark); text-decoration: none; }
.breadcrumbs a:hover { text-decoration: underline; }

/* ---------- calculator panel ---------- */
.tool-shell {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1.6rem; margin: 1.4rem 0 0;
}
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; margin-bottom: 1.2rem; }
.field label { display: block; font-weight: 700; font-size: .95rem; margin-bottom: .35rem; }
.field .hint { display: block; font-weight: 400; font-size: .85rem; color: var(--muted); margin-top: .3rem; }
.field input, .field select, .field textarea {
  width: 100%; padding: .7rem .8rem; font-size: 1.05rem; font-family: inherit;
  border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink);
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: 2px solid var(--brand); outline-offset: 1px; border-color: var(--brand);
}
.field textarea { min-height: 150px; resize: vertical; font-size: 1rem; line-height: 1.6; }

.btn {
  display: inline-block; background: var(--brand); color: #fff; border: none; cursor: pointer;
  font-size: 1.05rem; font-weight: 700; padding: .85rem 1.8rem; border-radius: 10px; font-family: inherit;
  min-height: 48px;
}
.btn:hover { background: var(--brand-dark); }
.btn:active { transform: translateY(1px); }
.btn-row { display: flex; gap: .8rem; flex-wrap: wrap; align-items: center; margin-top: .4rem; }
.btn-secondary { background: #fff; color: var(--brand-dark); border: 2px solid var(--brand); }

.results { margin-top: 1.6rem; border-top: 2px solid var(--brand-soft); padding-top: 1.2rem; }
.results h2, .results h3 { margin-top: 0; }
.big-number { font-size: 2.6rem; font-weight: 800; color: var(--brand-dark); letter-spacing: -.02em; line-height: 1.1; }
.result-meta { color: var(--muted); font-size: .95rem; }

table.data { width: 100%; border-collapse: collapse; margin: 1rem 0; font-size: .98rem; }
table.data th, table.data td { text-align: left; padding: .6rem .7rem; border-bottom: 1px solid var(--line); }
table.data th { background: var(--brand-soft); font-size: .88rem; text-transform: uppercase; letter-spacing: .03em; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data tr.total-row td { font-weight: 800; border-top: 2px solid var(--brand); }
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.winner { background: var(--brand-soft); border: 1px solid var(--brand); border-radius: 8px; padding: .7rem 1rem; margin: 1rem 0; font-weight: 700; color: var(--brand-dark); }
.notice { background: #fff8e6; border: 1px solid #f0d58a; border-radius: 8px; padding: .8rem 1rem; font-size: .95rem; }
.error { color: var(--danger); font-weight: 700; margin-top: .8rem; }

/* ---------- article content ---------- */
.article { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.8rem; margin-top: 2rem; box-shadow: var(--shadow); }
.article h2 { font-size: 1.4rem; margin: 2rem 0 .6rem; }
.article h2:first-child { margin-top: 0; }
.article h3 { font-size: 1.15rem; margin: 1.4rem 0 .4rem; }
.article ul, .article ol { padding-left: 1.4rem; }
.article li { margin-bottom: .4rem; }
.answer-intro { font-size: 1.1rem; color: var(--ink); }
.worked { background: var(--brand-soft); border-radius: 10px; padding: 1.2rem 1.4rem; margin: 1.4rem 0; }
.worked h3 { margin-top: 0; color: var(--brand-dark); }
.disclaimer { font-size: .9rem; color: var(--muted); border-left: 3px solid var(--accent); padding: .2rem 0 .2rem .9rem; margin: 1.4rem 0; }

/* ---------- FAQ ---------- */
.faq details { border: 1px solid var(--line); border-radius: 10px; margin-bottom: .7rem; background: #fff; }
.faq summary { padding: .9rem 1.1rem; font-weight: 700; cursor: pointer; list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::before { content: "+ "; color: var(--brand); font-weight: 800; }
.faq details[open] summary::before { content: "− "; }
.faq .faq-body { padding: 0 1.1rem 1rem; color: var(--ink); }

/* ---------- related ---------- */
.related-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .9rem; margin-top: 1rem; }

/* ---------- ad slots (fixed size — CLS-safe; filled after ad approval) ---------- */
.ad-slot {
  display: block; width: 100%; min-height: 90px; max-height: 280px;
  background: transparent; margin: 2rem auto; text-align: center; overflow: hidden;
}
.ad-slot.ad-leaderboard { min-height: 90px; max-width: 970px; }
.ad-slot.ad-incontent { min-height: 250px; max-width: 728px; }

/* ---------- footer ---------- */
.site-footer { background: var(--ink); color: #c9d4e0; margin-top: 3rem; padding: 2.5rem 0 1.5rem; }
.site-footer .cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1.5rem; margin-bottom: 1.8rem; }
.site-footer h4 { color: #fff; margin: 0 0 .6rem; font-size: 1rem; }
.site-footer a { color: #c9d4e0; text-decoration: none; font-size: .95rem; }
.site-footer a:hover { color: #fff; text-decoration: underline; }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin-bottom: .35rem; }
.site-footer .fine { border-top: 1px solid #33414f; padding-top: 1.2rem; font-size: .85rem; color: #93a3b5; }

/* ---------- misc ---------- */
.skip-link { position: absolute; left: -9999px; }
.skip-link:focus { left: 1rem; top: 1rem; background: #fff; padding: .5rem 1rem; z-index: 100; border-radius: 8px; }
.prose p { margin: 0 0 1rem; }
.center { text-align: center; }

@media (max-width: 640px) {
  body { font-size: 1rem; }
  .tool-shell, .article { padding: 1.1rem; }
  .big-number { font-size: 2rem; }
  .site-header .container { flex-direction: column; align-items: flex-start; gap: .4rem; }
  .site-nav { gap: .9rem; }
  .hero { padding: 2rem 0 1.8rem; }
  .btn { width: 100%; }
  .btn-row .btn { width: auto; }
}
