/* ==========================================================================
   Self-Employment Tax Calculator 2026
   Pure static stylesheet. No frameworks, no external fonts, no network calls.
   Layout is mobile-first; desktop enhancements use min-width media queries.
   ========================================================================== */

/* ---------- 1. Design tokens ---------- */
:root {
  --bg:            #f6f8f7;
  --surface:       #ffffff;
  --surface-alt:   #f1f5f3;
  --border:        #dfe6e2;
  --border-strong: #c6d2cc;

  --text:          #16241e;
  --text-soft:     #55655e;
  --text-faint:    #7c8b84;

  --brand:         #0f7b52;
  --brand-dark:    #0a5c3c;
  --brand-soft:    #e6f4ee;
  --brand-ring:    rgba(15, 123, 82, 0.22);

  --warn-bg:       #fff8ec;
  --warn-border:   #f0d9ab;
  --warn-text:     #7a5518;

  --radius:        10px;
  --radius-lg:     14px;

  --shadow-sm:     0 1px 2px rgba(16, 36, 30, 0.05);
  --shadow-md:     0 4px 16px rgba(16, 36, 30, 0.07);

  --maxw:          1080px;
}

/* ---------- 2. Reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; }

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

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

h1, h2, h3, h4 {
  line-height: 1.25;
  margin: 0 0 0.5em;
  color: var(--text);
  font-weight: 700;
  letter-spacing: -0.015em;
}

h1 { font-size: 1.85rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.1rem; }

p { margin: 0 0 1rem; }

a {
  color: var(--brand);
  text-decoration: underline;
  text-underline-offset: 2px;
}
a:hover { color: var(--brand-dark); }

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
  background: var(--surface-alt);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

/* ---------- 3. Layout primitives ---------- */
.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 1rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}

@media (min-width: 720px) {
  .wrap { padding: 0 1.5rem; }
  h1 { font-size: 2.3rem; }
  h2 { font-size: 1.6rem; }
  .card { padding: 2rem; }
}

/* ---------- 4. Header ---------- */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0.85rem 0;
  position: sticky;
  top: 0;
  z-index: 20;
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 700;
  font-size: 1.02rem;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.brand-mark {
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: 7px;
  background: var(--brand);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 0.9rem;
  font-weight: 700;
}

.brand-tag {
  font-weight: 500;
  font-size: 0.8rem;
  color: var(--text-faint);
  border-left: 1px solid var(--border-strong);
  padding-left: 0.55rem;
}

.site-nav {
  display: flex;
  gap: 1.15rem;
  font-size: 0.9rem;
}
.site-nav a { color: var(--text-soft); text-decoration: none; }
.site-nav a:hover { color: var(--brand); text-decoration: underline; }

/* ---------- 5. Hero ---------- */
.hero {
  padding: 1.75rem 0 1.25rem;
  text-align: center;
}

.eyebrow {
  display: inline-block;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  margin-bottom: 0.9rem;
}

.hero h1 { margin-bottom: 0.4rem; }

.hero-sub {
  color: var(--text-soft);
  max-width: 60ch;
  margin: 0 auto;
  font-size: 1.02rem;
}

/* ---------- 6. Calculator layout ---------- */
.calc-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  align-items: start;
  margin-bottom: 2rem;
}

@media (min-width: 940px) {
  .calc-layout {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 1.5rem;
  }
  .calc-inputs { position: sticky; top: 84px; }
}

.section-label {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-faint);
  margin: 0 0 0.9rem;
}

/* ---------- 7. Form ---------- */
.field { margin-bottom: 1rem; }

.field label {
  display: block;
  font-weight: 600;
  font-size: 0.92rem;
  margin-bottom: 0.3rem;
  color: var(--text);
}

.field .hint {
  display: block;
  font-size: 0.8rem;
  color: var(--text-faint);
  margin-top: 0.3rem;
  line-height: 1.45;
}

input[type="text"],
input[type="number"],
select {
  width: 100%;
  padding: 0.65rem 0.75rem;
  font-size: 1rem;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
  appearance: none;
}

select {
  background-image: linear-gradient(45deg, transparent 50%, var(--text-soft) 50%),
                    linear-gradient(135deg, var(--text-soft) 50%, transparent 50%);
  background-position: calc(100% - 19px) calc(50% + 2px),
                       calc(100% - 14px) calc(50% + 2px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 2.4rem;
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-ring);
}

.input-money { position: relative; }
.input-money::before {
  content: "$";
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-faint);
  font-size: 1rem;
  pointer-events: none;
}
.input-money input { padding-left: 1.85rem; }

.btn {
  width: 100%;
  padding: 0.8rem 1.25rem;
  font-size: 1rem;
  font-family: inherit;
  font-weight: 600;
  color: #fff;
  background: var(--brand);
  border: 1px solid var(--brand);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
  margin-top: 0.35rem;
}
.btn:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--brand-ring);
}

.btn-secondary {
  background: var(--surface);
  color: var(--brand-dark);
  border: 1px solid var(--border-strong);
  margin-top: 0.6rem;
}
.btn-secondary:hover {
  background: var(--surface-alt);
  color: var(--brand-dark);
  border-color: var(--brand);
}

/* ---------- 8. Results ---------- */
.results-card {
  border-top: 3px solid var(--brand);
}

.result-hero {
  background: var(--brand-soft);
  border-radius: var(--radius);
  padding: 1.05rem 1.15rem;
  margin-bottom: 1.15rem;
  text-align: center;
}

.result-hero .label {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--brand-dark);
}

.result-hero .amount {
  font-size: 2.1rem;
  font-weight: 700;
  color: var(--brand-dark);
  line-height: 1.15;
  margin-top: 0.15rem;
  word-break: break-word;
}

.result-hero .sub {
  font-size: 0.85rem;
  color: var(--text-soft);
  margin-top: 0.2rem;
}

/* ---------- 8b. Multi-tool results (aggregator pages) ---------- */
.hero-results {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.7rem;
  margin-bottom: 1.15rem;
}

@media (min-width: 520px) {
  .hero-results { grid-template-columns: repeat(2, 1fr); }
}

.mini-hero {
  background: var(--brand-soft);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  text-align: center;
}

.mini-hero .label {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--brand-dark);
  line-height: 1.35;
}

.mini-hero .amount {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--brand-dark);
  line-height: 1.2;
  margin-top: 0.2rem;
  word-break: break-word;
}

.result-group { margin-bottom: 1.25rem; }

.result-group h3 {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-faint);
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.55rem;
}

.result-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 0.4rem 0;
  font-size: 0.94rem;
  border-bottom: 1px dashed var(--border);
}
.result-row:last-child { border-bottom: 0; }

.result-row .k { color: var(--text-soft); }
.result-row .v {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  text-align: right;
}

.result-row.is-total {
  border-top: 2px solid var(--border-strong);
  border-bottom: 0;
  margin-top: 0.35rem;
  padding-top: 0.6rem;
  font-size: 1rem;
}
.result-row.is-total .k { color: var(--text); font-weight: 600; }
.result-row.is-total .v { color: var(--brand-dark); font-weight: 700; }

.result-row.is-positive .v { color: var(--brand-dark); }
.result-row.is-negative .v { color: #a8412f; }

.note-line {
  font-size: 0.8rem;
  color: var(--text-faint);
  margin-top: 0.5rem;
  line-height: 1.5;
}

/* ---------- 9. Callouts ---------- */
.callout {
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  color: var(--warn-text);
  border-radius: var(--radius);
  padding: 0.9rem 1.05rem;
  font-size: 0.89rem;
  margin: 1.25rem 0;
}
.callout strong { color: #5f4010; }
.callout p:last-child { margin-bottom: 0; }

.info-box {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
  font-size: 0.92rem;
  margin: 1.25rem 0;
}
.info-box p:last-child { margin-bottom: 0; }

/* ---------- 10. Tables ---------- */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 1rem 0 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  min-width: 460px;
}

th, td {
  padding: 0.6rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  background: var(--surface-alt);
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-soft);
  white-space: nowrap;
}

td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

tbody tr:last-child td { border-bottom: 0; }

/* ---------- 11. FAQ ---------- */
.faq-list { margin-top: 0.5rem; }

.faq-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  margin-bottom: 0.65rem;
  padding: 0.9rem 1.1rem;
}
.faq-item:last-child { margin-bottom: 0; }

.faq-item h3 {
  font-size: 1rem;
  margin-bottom: 0.4rem;
}
.faq-item p { margin-bottom: 0; color: var(--text-soft); font-size: 0.93rem; }
.faq-item p:last-child { margin-bottom: 0; }

/* ---------- 12. Prose content ---------- */
.prose { max-width: 72ch; }
.prose h2 { margin-top: 2.25rem; }
.prose h3 { margin-top: 1.6rem; }
.prose ul, .prose ol { padding-left: 1.35rem; margin: 0 0 1rem; }
.prose li { margin-bottom: 0.4rem; }
.prose dl { margin: 0 0 1rem; }
.prose dt { font-weight: 600; margin-top: 0.75rem; }
.prose dd { margin: 0.15rem 0 0 0; color: var(--text-soft); }

/* ---------- 12b. Aggregator: category blocks & tool grid ---------- */
.cat-block { margin-bottom: 2.5rem; }

.cat-block h2 {
  margin-bottom: 0.2rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--brand-soft);
}

.cat-blurb {
  color: var(--text-soft);
  font-size: 0.94rem;
  margin-bottom: 1.1rem;
}

.tool-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

@media (min-width: 560px)  { .tool-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 860px)  { .tool-grid { grid-template-columns: repeat(3, 1fr); } }

.tool-card {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.tool-card:hover {
  border-color: var(--brand);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  text-decoration: none;
}

.tool-cat {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--brand-dark);
}

.tool-name {
  font-weight: 600;
  color: var(--text);
  font-size: 1rem;
  line-height: 1.35;
}

.tool-card:hover .tool-name { color: var(--brand-dark); }

.tool-desc {
  font-size: 0.85rem;
  color: var(--text-soft);
  line-height: 1.5;
}

.related { margin-top: 2.5rem; }
.related h2 { margin-bottom: 0.9rem; }

.see-all { margin-top: 1rem; }
.see-all a { font-weight: 600; }

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 1rem 0;
}
.badge {
  font-size: 0.78rem;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  color: var(--text-soft);
  border-radius: 999px;
  padding: 0.2rem 0.65rem;
}

/* ---------- 13. Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  margin-top: 3rem;
  padding: 2rem 0 2.5rem;
  font-size: 0.89rem;
  color: var(--text-soft);
}

.site-footer .wrap { max-width: var(--maxw); }

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1.15rem;
  margin-bottom: 0.9rem;
}
.footer-links a { color: var(--text-soft); text-decoration: none; }
.footer-links a:hover { color: var(--brand); text-decoration: underline; }

.footer-meta {
  border-top: 1px solid var(--border);
  padding-top: 0.9rem;
  font-size: 0.83rem;
  color: var(--text-faint);
}
.footer-meta p { margin-bottom: 0.35rem; }

/* ---------- 14. Legal pages ---------- */
.page-title { margin-top: 1.75rem; margin-bottom: 0.35rem; }
.page-updated {
  font-size: 0.85rem;
  color: var(--text-faint);
  margin-bottom: 1.5rem;
}

/* ---------- 15. Utilities ---------- */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.text-center { text-align: center; }

/* ---------- 16. Print ---------- */
@media print {
  .site-header, .site-footer, .calc-inputs, .btn { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; border: 1px solid #ccc; }
}
