/* WageClear — shared stylesheet. System fonts, single teal accent, neutral grays. */

:root {
  --teal: #0ca678;
  --teal-dark: #099268;
  --teal-soft: #e6f7f1;
  --ink: #1a2b26;
  --body: #33413c;
  --muted: #6b7a74;
  --line: #e2e8e5;
  --bg: #ffffff;
  --bg-soft: #f6f9f8;
  --card: #ffffff;
  --shadow: 0 1px 2px rgba(16, 40, 34, .04), 0 8px 24px rgba(16, 40, 34, .06);
  --radius: 14px;
  --radius-sm: 9px;
  --seg-base: #0ca678;
  --seg-ot: #38b2ac;
  --seg-dt: #f59f00;
  --danger: #c92a2a;
  --maxw: 760px;
  font-size: 16px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --teal: #2dd4a7;
    --teal-dark: #21c397;
    --teal-soft: #12312a;
    --ink: #eef4f2;
    --body: #c4d0cb;
    --muted: #8b9a94;
    --line: #26332e;
    --bg: #0e1512;
    --bg-soft: #131c18;
    --card: #16201c;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35);
    --seg-base: #2dd4a7;
    --seg-ot: #4fd1c5;
    --seg-dt: #fcc419;
    --danger: #ff8787;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--body);
  background: var(--bg);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: var(--teal-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { color: var(--ink); line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: clamp(1.7rem, 4.5vw, 2.4rem); margin: 0 0 .5rem; }
h2 { font-size: 1.4rem; margin: 2.5rem 0 .8rem; }
h3 { font-size: 1.1rem; margin: 1.6rem 0 .5rem; }
p { margin: 0 0 1rem; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

/* ---- header ---- */
.site-header {
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  position: sticky; top: 0; z-index: 20;
  backdrop-filter: saturate(180%) blur(8px);
}
.nav {
  max-width: 1000px; margin: 0 auto; padding: 0 20px;
  display: flex; align-items: center; gap: 8px;
  min-height: 60px; flex-wrap: wrap;
}
.brand {
  display: inline-flex; align-items: center; gap: 9px;
  font-weight: 700; font-size: 1.12rem; color: var(--ink);
  margin-right: auto; padding: 8px 0;
}
.brand:hover { text-decoration: none; }
.brand svg { display: block; }
.nav-links { display: flex; gap: 2px; flex-wrap: wrap; }
.nav-links a {
  color: var(--body); padding: 9px 11px; border-radius: 8px;
  font-size: .92rem; font-weight: 500; line-height: 1.2;
}
.nav-links a:hover { background: var(--bg-soft); text-decoration: none; color: var(--ink); }
.nav-links a[aria-current="page"] { color: var(--teal-dark); background: var(--teal-soft); }

/* ---- hero / intro ---- */
.hero { padding: 40px 0 8px; }
.hero p.lead { font-size: 1.08rem; color: var(--muted); max-width: 60ch; }
.eyebrow {
  display: inline-block; font-size: .78rem; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase; color: var(--teal-dark);
  background: var(--teal-soft); padding: 4px 10px; border-radius: 20px; margin-bottom: 14px;
}

/* ---- tool card ---- */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 22px; margin: 22px 0;
}
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; color: var(--ink); margin-bottom: 6px; font-size: .95rem; }
.field .hint { font-weight: 400; color: var(--muted); font-size: .85rem; }
.input-row { display: flex; gap: 12px; flex-wrap: wrap; }
.input-row .field { flex: 1 1 150px; margin-bottom: 0; }

.money-wrap { position: relative; display: flex; align-items: center; }
.money-wrap .prefix {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--muted); font-weight: 600; pointer-events: none;
}
/* Reserve a fixed left zone for the $ so digits can never overlap it, at any
   input length. Higher specificity than the `input[type="text"]` shorthand
   below so the reserved padding wins regardless of source order. */
.money-wrap input,
.money-wrap input[type="text"],
.money-wrap input[type="number"] { padding-left: 28px; }

input[type="text"], input[type="number"], select {
  width: 100%; min-height: 46px; padding: 10px 12px;
  border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  background: var(--bg); color: var(--ink); font-size: 1rem;
  font-family: inherit; -moz-appearance: textfield;
}
input:focus, select:focus {
  outline: none; border-color: var(--teal);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--teal) 22%, transparent);
}
input::-webkit-outer-spin-button, input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
select {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path d='M1 1l5 5 5-5' stroke='%236b7a74' stroke-width='2' fill='none' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat; background-position: right 14px center; padding-right: 34px;
}

/* segmented toggle */
.seg {
  display: inline-flex; background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: 10px; padding: 3px; gap: 3px; flex-wrap: wrap;
}
.seg button {
  border: none; background: transparent; color: var(--body);
  padding: 8px 14px; border-radius: 7px; font-size: .9rem; font-weight: 600;
  cursor: pointer; min-height: 40px; font-family: inherit;
}
.seg button[aria-pressed="true"] { background: var(--teal); color: #fff; }
.seg button:hover:not([aria-pressed="true"]) { color: var(--ink); }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 46px; padding: 11px 18px; border-radius: var(--radius-sm);
  font-size: 1rem; font-weight: 600; font-family: inherit; cursor: pointer;
  border: 1.5px solid transparent; background: var(--teal); color: #fff;
}
.btn:hover { background: var(--teal-dark); text-decoration: none; }
.btn.secondary { background: transparent; color: var(--teal-dark); border-color: var(--line); }
.btn.secondary:hover { background: var(--bg-soft); }
.btn.small { min-height: 38px; padding: 7px 12px; font-size: .88rem; }

.controls { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 4px; }

/* error message */
.error {
  color: var(--danger); font-size: .9rem; margin-top: 10px; display: none;
}
.error.show { display: block; }

/* ---- results ---- */
.results { margin-top: 20px; border-top: 1px solid var(--line); padding-top: 20px; }
.headline {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 4px;
}
.headline .big {
  font-size: clamp(1.9rem, 6vw, 2.6rem); font-weight: 700; color: var(--teal-dark);
  letter-spacing: -.02em; line-height: 1.1;
}
.headline .label { color: var(--muted); font-size: .95rem; }

.stat-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px; margin: 16px 0;
}
.stat {
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 13px 14px;
}
.stat .k { font-size: .8rem; color: var(--muted); font-weight: 500; margin-bottom: 3px; }
.stat .v { font-size: 1.3rem; font-weight: 700; color: var(--ink); letter-spacing: -.01em; }
.stat .v.pos { color: var(--teal-dark); }

/* period breakdown table */
table.breakdown { width: 100%; border-collapse: collapse; margin: 14px 0; font-size: .95rem; }
table.breakdown th, table.breakdown td {
  text-align: right; padding: 10px 12px; border-bottom: 1px solid var(--line);
}
table.breakdown th:first-child, table.breakdown td:first-child { text-align: left; }
table.breakdown thead th { color: var(--muted); font-weight: 600; font-size: .82rem; text-transform: uppercase; letter-spacing: .03em; }
table.breakdown tbody tr:last-child td { border-bottom: none; }
table.breakdown td.num { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--ink); }
table.breakdown tr.total td { border-top: 2px solid var(--line); font-weight: 700; }

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* stacked bar */
.bar-wrap { margin: 18px 0; }
.bar {
  display: flex; width: 100%; height: 46px; border-radius: 10px; overflow: hidden;
  border: 1px solid var(--line); background: var(--bg-soft);
}
.bar span {
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: .8rem; font-weight: 700; min-width: 0;
  white-space: nowrap; overflow: hidden; transition: flex-basis .25s ease;
}
.seg-base { background: var(--seg-base); }
.seg-ot { background: var(--seg-ot); }
.seg-dt { background: var(--seg-dt); color: #3d2f00; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 12px; font-size: .88rem; }
.legend .dot { display: inline-flex; align-items: center; gap: 7px; color: var(--body); }
.legend .swatch { width: 13px; height: 13px; border-radius: 3px; display: inline-block; }

/* copy toast */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 10px;
  font-size: .9rem; font-weight: 600; opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s; z-index: 50;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---- prose / content ---- */
.prose { margin: 8px 0; }
.prose ul, .prose ol { margin: 0 0 1rem; padding-left: 1.3em; }
.prose li { margin-bottom: .4rem; }
.prose ol.steps { counter-reset: step; list-style: none; padding-left: 0; }
.prose ol.steps li {
  position: relative; padding-left: 42px; margin-bottom: 14px;
}
.prose ol.steps li::before {
  counter-increment: step; content: counter(step);
  position: absolute; left: 0; top: 0; width: 28px; height: 28px;
  background: var(--teal-soft); color: var(--teal-dark); border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .9rem;
}
.callout {
  background: var(--bg-soft); border: 1px solid var(--line); border-left: 3px solid var(--teal);
  border-radius: 8px; padding: 14px 16px; margin: 16px 0; font-size: .95rem;
}
.callout strong { color: var(--ink); }

.formula {
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: 8px;
  padding: 12px 14px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .9rem; color: var(--ink); overflow-x: auto; margin: 12px 0;
}

/* FAQ */
.faq details {
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 0; margin-bottom: 10px; background: var(--card); overflow: hidden;
}
.faq summary {
  cursor: pointer; padding: 15px 16px; font-weight: 600; color: var(--ink);
  list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--teal-dark); font-size: 1.3rem; font-weight: 400; flex: none; }
.faq details[open] summary::after { content: "\2212"; }
.faq details[open] summary { border-bottom: 1px solid var(--line); }
.faq .answer { padding: 14px 16px; }
.faq .answer p:last-child { margin-bottom: 0; }

/* related tools */
.related-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-top: 8px;
}
.related-card {
  display: block; border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 15px 16px; background: var(--card); color: var(--body); transition: border-color .15s;
}
.related-card:hover { border-color: var(--teal); text-decoration: none; }
.related-card .t { font-weight: 700; color: var(--ink); margin-bottom: 3px; }
.related-card .d { font-size: .88rem; color: var(--muted); }

/* disclaimer */
.disclaimer {
  font-size: .85rem; color: var(--muted); border-top: 1px solid var(--line);
  padding-top: 16px; margin-top: 30px;
}

/* ad slot: zero height, never draws a fake box */
.ad-slot { height: 0; overflow: hidden; margin: 0; }

/* ---- footer ---- */
.site-footer {
  border-top: 1px solid var(--line); margin-top: 50px; padding: 30px 0 40px;
  background: var(--bg-soft); color: var(--muted); font-size: .9rem;
}
.footer-inner { max-width: 1000px; margin: 0 auto; padding: 0 20px; }
.footer-links { display: flex; gap: 18px; flex-wrap: wrap; margin-bottom: 12px; }
.footer-links a { color: var(--body); }
.footer-brand { font-weight: 700; color: var(--ink); }

/* content section spacing */
section.block { margin-top: 30px; }

/* skip link */
.skip {
  position: absolute; left: -999px; top: 0; background: var(--teal); color: #fff;
  padding: 10px 14px; border-radius: 0 0 8px 0; z-index: 100;
}
.skip:focus { left: 0; }

@media (max-width: 520px) {
  .hero { padding: 26px 0 4px; }
  .card { padding: 18px 16px; }
  .nav { min-height: 56px; }
}
