/* TechAkhon. One idea carries the design: the result is a pay stub.
   Everything else stays quiet so the stub is the thing you look at. */

@font-face {
  font-family: 'Public Sans';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('/assets/fonts/public-sans-latin.woff2') format('woff2');
}

:root {
  --desk: #f0f1f3;      /* the surface the paper sits on */
  --paper: #fffefc;     /* the stub itself */
  --ink: #212121;       /* the black of the logo */
  --ink-soft: #575b62;
  --brand: #ff5722;     /* the orange of the logo: marks and accents only, too light for text */
  --brand-deep: #c2410c; /* the same orange, dark enough for links, focus and filled controls */
  --brand-darker: #9a330a;
  --rule: #d3d6db;
  --edge: #9aa0a8;      /* input borders */
  --marker: #ffc7ad;    /* highlighter over the answer */
  --measure: 68ch;
  --gap: clamp(1rem, 2.4vw, 1.75rem);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--desk);
  color: var(--ink);
  font: 400 1.0625rem/1.6 'Public Sans', system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}
img, svg { max-width: 100%; }
a { color: var(--brand-deep); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { color: var(--brand-darker); text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--brand-deep); outline-offset: 2px; border-radius: 2px; }
h1, h2, h3 { line-height: 1.15; letter-spacing: -0.015em; margin: 0; }
h1 { font-size: clamp(2.1rem, 5.2vw, 3.4rem); font-weight: 800; letter-spacing: -0.03em; }
h2 { font-size: clamp(1.35rem, 2.6vw, 1.7rem); font-weight: 700; }
h3 { font-size: 1.1rem; font-weight: 700; }
p, ul, ol { margin: 0; }

.wrap { width: min(100% - 2rem, 72rem); margin-inline: auto; }
.skip { position: absolute; left: -999px; top: 0; background: var(--ink); color: #fff; padding: 0.6rem 1rem; z-index: 10; }
.skip:focus { left: 0; }

/* ---------- header and footer ---------- */
.site-head { border-bottom: 1px solid var(--rule); background: var(--desk); }
.site-head .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-block: 0.9rem; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; }
.brand img { display: block; height: 2.75rem; width: auto; }
.site-nav { display: flex; gap: clamp(0.9rem, 2.5vw, 1.6rem); flex-wrap: wrap; }
.site-nav a { color: var(--ink); text-decoration: none; font-weight: 600; font-size: 0.98rem; padding-block: 0.25rem; border-bottom: 2px solid transparent; }
.site-nav a:hover, .site-nav a[aria-current='page'] { border-bottom-color: var(--brand); }

.site-foot { margin-top: clamp(3rem, 7vw, 5rem); border-top: 1px solid var(--rule); padding-block: 2rem 2.5rem; color: var(--ink-soft); font-size: 0.95rem; }
.site-foot .wrap { display: grid; gap: 1rem; }
.foot-links { display: flex; flex-wrap: wrap; gap: 0.4rem 1.3rem; list-style: none; padding: 0; }
.foot-links a { color: var(--ink); }
.site-foot p { max-width: var(--measure); }

/* ---------- page top ---------- */
.page-top { padding-block: clamp(1.75rem, 5vw, 3.25rem) clamp(1.25rem, 3vw, 2rem); }
.crumbs { font-size: 0.92rem; color: var(--ink-soft); margin-bottom: 0.9rem; }
.crumbs a { color: var(--ink-soft); }
.lede { font-size: clamp(1.1rem, 2vw, 1.3rem); line-height: 1.45; color: var(--ink-soft); max-width: 46ch; margin-top: 0.8rem; }

/* ---------- the tool: form beside the stub ---------- */
.tool { display: grid; gap: var(--gap); align-items: start; }
@media (min-width: 56rem) {
  .tool { grid-template-columns: minmax(0, 1fr) minmax(22rem, 27rem); }
  .tool .stub { position: sticky; top: 1rem; }
}

.calc-form { display: grid; gap: 1.1rem; background: #fff; border: 1px solid var(--rule); border-radius: 10px; padding: clamp(1rem, 2.6vw, 1.6rem); }
.field { display: grid; gap: 0.35rem; border: 0; padding: 0; margin: 0; min-width: 0; }
.field[hidden] { display: none; }
.field > label, .field > legend { font-weight: 600; font-size: 0.98rem; padding: 0; }
.hint { font-size: 0.88rem; color: var(--ink-soft); line-height: 1.4; }
.input { display: flex; align-items: stretch; border: 1px solid var(--edge); border-radius: 6px; background: #fff; overflow: hidden; }
.input:focus-within { outline: 3px solid var(--brand-deep); outline-offset: 1px; border-color: var(--brand-deep); }
.input input, .input select { flex: 1; min-width: 0; border: 0; background: transparent; font: inherit; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink); padding: 0.7rem 0.8rem; min-height: 3rem; }
.input input:focus, .input select:focus { outline: none; }
.input .unit { display: grid; place-items: center; padding-inline: 0.8rem; background: var(--desk); color: var(--ink-soft); font-weight: 700; }
.input .unit:first-child { border-right: 1px solid var(--rule); }
.input .unit:last-child { border-left: 1px solid var(--rule); }

.choice { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; border: 1px solid var(--edge); border-radius: 6px; overflow: hidden; }
.choice label { display: grid; place-items: center; text-align: center; padding: 0.65rem 0.6rem; min-height: 3rem; font-weight: 600; font-size: 0.98rem; cursor: pointer; background: #fff; position: relative; }
.choice label + label { border-left: 1px solid var(--edge); }
.choice input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.choice label:has(input:checked) { background: var(--brand-deep); color: #fff; }
.choice label:has(input:focus-visible) { outline: 3px solid var(--ink); outline-offset: -3px; }

/* ---------- the pay stub ---------- */
.stub {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-top: 0;
  border-radius: 0 0 10px 10px;
  padding: 1.6rem clamp(1rem, 2.6vw, 1.5rem) 1.3rem;
  position: relative;
  box-shadow: 0 1px 0 #fff inset, 0 14px 30px -22px rgba(33, 33, 33, 0.45);
  font-variant-numeric: tabular-nums;
}
/* torn-off perforation along the top edge */
.stub::before {
  content: '';
  position: absolute; left: -1px; right: -1px; top: -7px; height: 14px;
  background: radial-gradient(circle at 7px 7px, var(--desk) 4.5px, transparent 5px) 0 0 / 14px 14px repeat-x, linear-gradient(var(--paper), var(--paper)) 0 7px / 100% 7px no-repeat;
}
.stub-title { font-size: 0.95rem; font-weight: 600; color: var(--ink-soft); letter-spacing: 0; margin-bottom: 1rem; }
.stub-net { display: grid; gap: 0.15rem; padding-bottom: 1.1rem; border-bottom: 2px solid var(--ink); }
.stub-net-label { font-weight: 600; }
.stub-net-value {
  font-size: clamp(2.3rem, 7vw, 3.1rem); font-weight: 800; letter-spacing: -0.035em; line-height: 1.05;
  justify-self: start; padding-inline: 0.12em;  margin-left: -0.12em;
  background: linear-gradient(transparent 58%, var(--marker) 58%, var(--marker) 92%, transparent 92%);
}
.stub-lines { margin: 0.9rem 0 0; display: grid; gap: 0.15rem; }
.stub-line { display: flex; align-items: baseline; align-items: last baseline; gap: 0.5rem; padding-block: 0.28rem; }
.stub-line dt { flex: 0 1 auto; }
.stub-line dd { margin: 0 0 0 auto; font-weight: 700; white-space: nowrap; flex: none; }
/* dotted leader between the label and the amount, as on a printed statement */
.stub-line dt::after { content: none; }
.stub-line { background: linear-gradient(to right, var(--rule) 40%, transparent 0) 0 calc(100% - 0.55rem) / 6px 1px repeat-x; }
.stub-line dt, .stub-line dd { background: var(--paper); }
.stub-line dt { padding-right: 0.4rem; }
.stub-line dd { padding-left: 0.4rem; }
.stub-line.is-out dd { color: var(--ink-soft); }
.stub-line.is-sum { border-top: 1px solid var(--ink); margin-top: 0.3rem; padding-top: 0.5rem; background: none; font-weight: 700; }
.stub-note { margin-top: 1rem; font-size: 0.88rem; line-height: 1.45; color: var(--ink-soft); }
@media (prefers-reduced-motion: no-preference) {
  .stub.is-fresh .stub-net-value { animation: ink 0.35s ease-out; }
  @keyframes ink { from { background-size: 0 100%; } to { background-size: 100% 100%; } }
  .stub-net-value { background-repeat: no-repeat; }
}

/* ---------- tables ---------- */
.table-scroll { overflow-x: auto; margin-top: var(--gap); }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; background: #fff; border: 1px solid var(--rule); border-radius: 8px; font-size: 0.98rem; }
caption { text-align: left; font-weight: 700; padding: 0 0 0.6rem; caption-side: top; }
th, td { padding: 0.6rem 0.85rem; text-align: right; border-bottom: 1px solid var(--rule); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
thead th { font-weight: 700; background: var(--desk); border-bottom: 1px solid var(--edge); white-space: normal; }
tbody th { font-weight: 600; }
tbody tr:last-child > * { border-bottom: 0; }

/* ---------- article text ---------- */
.prose { max-width: var(--measure); margin-top: clamp(2.25rem, 6vw, 3.5rem); }
.prose > * + * { margin-top: 1rem; }
.prose > h2 { margin-top: 2.4rem; }
.prose ul, .prose ol { padding-left: 1.3rem; display: grid; gap: 0.45rem; }
.prose table { margin-top: 0.4rem; }
.prose .formula { font-weight: 700; font-size: 1.1rem; padding: 0.9rem 1.1rem; background: #fff; border-left: 4px solid var(--brand); overflow-x: auto; white-space: nowrap; }
.faq { display: grid; gap: 0; border-top: 1px solid var(--rule); }
.faq details { border-bottom: 1px solid var(--rule); }
.faq summary { cursor: pointer; font-weight: 700; padding: 0.95rem 2rem 0.95rem 0; list-style: none; position: relative; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; position: absolute; right: 0.3rem; top: 0.75rem; font-size: 1.4rem; font-weight: 400; color: var(--brand-deep); }
.faq details[open] summary::after { content: '−'; }
.faq details p { padding-bottom: 1.1rem; }
.sources { font-size: 0.95rem; }
.checked { color: var(--ink-soft); font-size: 0.95rem; }

/* ---------- lists of calculators ---------- */
.shelf { margin-top: clamp(2.5rem, 7vw, 4.5rem); display: grid; gap: clamp(2rem, 5vw, 3rem); }
.group { display: grid; gap: 0.9rem; }
@media (min-width: 52rem) { .group { grid-template-columns: 15rem minmax(0, 1fr); gap: 2rem; } }
.group-head p { color: var(--ink-soft); margin-top: 0.4rem; font-size: 0.98rem; }
.calc-list { list-style: none; padding: 0; margin: 0; border-top: 2px solid var(--ink); }
.calc-list a { display: grid; gap: 0.1rem; padding: 0.95rem 0.25rem; border-bottom: 1px solid var(--rule); text-decoration: none; color: var(--ink); }
@media (min-width: 40rem) { .calc-list a { grid-template-columns: 17rem minmax(0, 1fr); align-items: baseline; gap: 1rem; } }
.calc-list strong { font-size: 1.1rem; color: var(--brand-deep); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
.calc-list span { color: var(--ink-soft); }
.calc-list a:hover { background: #fff; }
.calc-list a:hover strong { text-decoration-thickness: 2px; }

.related { margin-top: 2.6rem; max-width: var(--measure); }
.related h2 { margin-bottom: 0.8rem; }

/* ---------- home ---------- */
.home-top { padding-block: clamp(2rem, 6vw, 4rem) 0; display: grid; gap: var(--gap); align-items: start; }
@media (min-width: 56rem) { .home-top { grid-template-columns: minmax(0, 1fr) minmax(22rem, 27rem); gap: clamp(2rem, 5vw, 4rem); } }
.home-top h1 { max-width: 12ch; }
.home-top .lede { max-width: 38ch; }
.wage { margin-top: 1.8rem; max-width: 22rem; display: grid; gap: 0.4rem; }
.wage label { font-weight: 700; }
.wage .input input { font-size: 1.5rem; font-weight: 800; padding-block: 0.6rem; }
.wage a { font-weight: 600; margin-top: 0.5rem; }
.trust { margin-top: clamp(2.5rem, 7vw, 4.5rem); max-width: var(--measure); display: grid; gap: 1rem; }

.plain-page { max-width: var(--measure); }
.plain-page.prose { margin-top: 0; }
