/* Overtime Calc — one stylesheet, no dependencies, no web fonts.
   Look: warm paper, deep green ink, results printed like a pay stub. */

:root {
  --paper: #f6f3eb;
  --paper-2: #efe9db;
  --surface: #fffefb;
  --surface-2: #faf7ef;
  --ink: #1b1c19;
  --muted: #5b5d55;
  --line: #e2dccd;
  --line-strong: #c4bca7;
  --accent: #0e5a48;
  --accent-strong: #0a4335;
  --accent-ink: #ffffff;
  --accent-soft: #dfeee7;
  --accent-softer: #edf5f1;
  --gold: #8a5508;
  --gold-soft: #fbefd2;
  --notice: #fdf4dc;
  --notice-line: #e0bf62;
  --danger: #a3341f;
  --danger-soft: #fbe9e3;
  --footer-bg: #0c2f27;
  --footer-ink: #e3ede8;
  --footer-muted: #a5bdb3;
  --footer-line: #21493f;

  --shadow-sm: 0 1px 2px rgb(40 35 20 / 0.06), 0 2px 8px rgb(40 35 20 / 0.05);
  --shadow-md: 0 2px 4px rgb(40 35 20 / 0.05), 0 16px 36px -14px rgb(40 35 20 / 0.24);

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  --radius: 14px;
  --radius-sm: 9px;
  --measure: 44rem;
  --header-h: 4rem;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #111412;
    --paper-2: #151a17;
    --surface: #1a1e1b;
    --surface-2: #202521;
    --ink: #ecebe5;
    --muted: #a8aaa0;
    --line: #2c312c;
    --line-strong: #474d46;
    --accent: #6fd0b1;
    --accent-strong: #9be3cb;
    --accent-ink: #082119;
    --accent-soft: #1a322b;
    --accent-softer: #162722;
    --gold: #e3b356;
    --gold-soft: #2e2713;
    --notice: #2a2513;
    --notice-line: #8c7a2e;
    --danger: #f2977f;
    --danger-soft: #35211c;
    --footer-bg: #0b0e0c;
    --footer-ink: #dcdfd7;
    --footer-muted: #969b90;
    --footer-line: #242a25;

    --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.4);
    --shadow-md: 0 2px 4px rgb(0 0 0 / 0.3), 0 16px 36px -14px rgb(0 0 0 / 0.7);
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 1rem;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 1.0625rem/1.65 var(--sans);
  overflow-wrap: break-word;
}

h1,
h2,
h3 {
  font-family: var(--serif);
  line-height: 1.2;
  text-wrap: balance;
  margin: 0;
}

h1 {
  font-size: clamp(2.1rem, 1.45rem + 3.1vw, 3.3rem);
  letter-spacing: -0.02em;
  line-height: 1.08;
}

p,
ul,
ol,
dl,
dd,
figure {
  margin: 0;
}

a {
  color: var(--accent);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

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

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

main:focus {
  outline: none;
}

[hidden] {
  display: none !important;
}

code {
  font-family: var(--mono);
  font-size: 0.92em;
  padding: 0.08em 0.35em;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 5px;
}

.icon {
  flex: none;
  vertical-align: -0.2em;
}

.wrap {
  width: min(100% - 2rem, 72rem);
  margin-inline: auto;
}

.skip-link {
  position: absolute;
  left: 0.5rem;
  top: -4rem;
  z-index: 30;
  padding: 0.6rem 0.9rem;
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: 8px;
}

.skip-link:focus {
  top: 0.5rem;
  color: var(--accent-ink);
}

/* ---------- Header ---------- */

.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.site-header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0 1.5rem;
  padding-block: 0.45rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--ink);
  text-decoration: none;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: -0.01em;
  min-height: 2.75rem;
}

.brand:hover {
  color: var(--ink);
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  min-width: 2.5rem;
  height: 2.1rem;
  padding-inline: 0.4rem;
  border-radius: 9px;
  background: var(--accent);
  color: var(--accent-ink);
  font-family: var(--sans);
  font-size: 0.9rem;
  font-weight: 750;
  letter-spacing: -0.02em;
  box-shadow: inset 0 -2px 0 rgb(0 0 0 / 0.18);
}

.nav-list {
  display: flex;
  gap: 0.15rem;
  list-style: none;
  padding: 0 0 0.35rem;
  margin-inline: -0.25rem;
  font-size: 0.95rem;
  overflow-x: auto;
  scrollbar-width: none;
  max-width: calc(100vw - 2rem);
}

@media (max-width: 51.99rem) {
  /* The calculators scroll sideways on a phone: fade the edge to show there is more. */
  .nav-list {
    -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 2.5rem), transparent);
    mask-image: linear-gradient(90deg, #000 calc(100% - 2.5rem), transparent);
    padding-right: 2rem;
  }
}

.nav-list::-webkit-scrollbar {
  display: none;
}

.nav-list a {
  display: inline-flex;
  align-items: center;
  min-height: 2.5rem;
  padding-inline: 0.8rem;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
  border-radius: 999px;
  font-weight: 500;
}

.nav-list a:hover {
  color: var(--ink);
  background: var(--paper-2);
}

.nav-list a[aria-current="page"] {
  color: var(--accent-strong);
  background: var(--accent-soft);
  font-weight: 650;
}

@media (min-width: 52rem) {
  .site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    -webkit-backdrop-filter: saturate(1.4) blur(12px);
    backdrop-filter: saturate(1.4) blur(12px);
  }

  .site-header-inner {
    flex-wrap: nowrap;
    min-height: var(--header-h);
    padding-block: 0;
  }

  .nav-list {
    padding-bottom: 0;
  }

  html {
    scroll-padding-top: calc(var(--header-h) + 1.25rem);
  }
}

/* ---------- Buttons ---------- */

input,
select,
button {
  font: inherit;
  color: inherit;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  justify-self: start;
  min-height: 3.1rem;
  padding: 0.65rem 1.5rem;
  background: var(--accent);
  color: var(--accent-ink);
  border: 1.5px solid var(--accent);
  border-radius: 11px;
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 1px 0 rgb(0 0 0 / 0.08), 0 6px 14px -8px var(--accent);
  transition: background-color 0.15s, border-color 0.15s, transform 0.15s;
}

.button:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  color: var(--accent-ink);
}

.button:active {
  transform: translateY(1px);
}

.button-ghost {
  background: transparent;
  color: var(--accent);
  border-color: var(--line-strong);
  box-shadow: none;
}

.button-ghost:hover {
  background: var(--accent-softer);
  color: var(--accent-strong);
  border-color: var(--accent);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 2.5rem;
  padding: 0.35rem 0.85rem;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 550;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s;
}

.chip:hover {
  background: var(--accent-softer);
  border-color: var(--accent);
  color: var(--accent-strong);
}

/* ---------- Page head ---------- */

.page-head {
  padding-block: clamp(1.75rem, 1rem + 3vw, 3.25rem) clamp(1.25rem, 1rem + 1.5vw, 2rem);
  max-width: 52rem;
}

.crumbs {
  margin-bottom: 1.1rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.crumbs ol,
.prose .crumbs ol {
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.crumbs li,
.prose .crumbs li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 1.5rem;
  margin: 0;
}

.prose-page > .crumbs {
  margin: 0 0 1.1rem;
}

.crumbs li + li::before {
  content: "/";
  opacity: 0.55;
}

.crumbs a {
  color: inherit;
  padding-block: 0.35rem;
}

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

.byline {
  margin-top: 0.35rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.byline a,
.question-list a {
  padding-block: 0.3rem;
}

.prose-page > .byline {
  margin-top: 2.4rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.eyebrow {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.8rem;
}

.eyebrow::before {
  content: "";
  flex: none;
  align-self: center;
  width: 1.5rem;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
}

.lede {
  margin-top: 1rem;
  font-size: clamp(1.12rem, 1.02rem + 0.5vw, 1.32rem);
  line-height: 1.5;
  color: var(--ink);
  text-wrap: pretty;
}

.checked {
  margin-top: 1rem;
  font-size: 0.9rem;
  color: var(--muted);
}

/* ---------- Page layout with "On this page" rail ---------- */

.page-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}

.page-grid > * {
  grid-column: 1 / -1;
  min-width: 0;
}

.toc {
  display: none;
}

@media (min-width: 72rem) {
  .page-grid {
    grid-template-columns: minmax(0, 46rem) minmax(0, 1fr);
    column-gap: 4rem;
  }

  .page-grid > .prose {
    grid-column: 1;
  }

  .page-grid > .toc {
    display: block;
    grid-column: 2;
    grid-row: 3 / span 2;
    align-self: start;
    justify-self: end;
    width: min(100%, 17rem);
    position: sticky;
    top: calc(var(--header-h) + 1.5rem);
    padding: 1.1rem 1.2rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
  }
}

.toc h2 {
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.toc ol {
  list-style: none;
  padding: 0;
  font-size: 0.92rem;
  line-height: 1.35;
}

.toc a {
  display: block;
  padding: 0.38rem 0 0.38rem 0.8rem;
  border-left: 2px solid var(--line);
  color: var(--muted);
  text-decoration: none;
}

.toc a:hover {
  color: var(--accent-strong);
  border-left-color: var(--accent);
}

/* ---------- Calculator ---------- */

.calc {
  display: grid;
  gap: 1.25rem;
  align-items: start;
  margin-bottom: clamp(2.25rem, 1rem + 4vw, 4.5rem);
}

@media (min-width: 56rem) {
  .calc {
    grid-template-columns: minmax(0, 1fr) minmax(21rem, 27rem);
    gap: 1.75rem;
  }

  .calc > .stub {
    position: sticky;
    top: calc(var(--header-h) + 1.25rem);
  }
}

.calc-form {
  display: grid;
  gap: 1.25rem;
  padding: clamp(1.1rem, 0.6rem + 2vw, 1.9rem);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  display: grid;
  gap: 0.75rem;
}

legend {
  padding: 0;
  font-weight: 650;
  margin-bottom: 0.6rem;
}

.optional {
  font-weight: 400;
  color: var(--muted);
}

.field {
  display: grid;
  gap: 0.35rem;
  min-width: 0;
  align-content: start;
}

label {
  font-size: 0.95rem;
  font-weight: 600;
}

fieldset .field label {
  font-weight: 500;
  color: var(--muted);
}

.hint {
  font-size: 0.875rem;
  line-height: 1.45;
  color: var(--muted);
}

.field-pair,
.field-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.field-row {
  align-items: end;
}

.field-days {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

@media (min-width: 30rem) {
  .field-days {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

input[type="number"],
select {
  width: 100%;
  min-height: 3.1rem;
  padding: 0.5rem 0.8rem;
  background: var(--surface-2);
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-sm);
  font-variant-numeric: tabular-nums;
  font-size: 1.05rem;
  transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s;
}

input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type="number"]:hover,
select:hover {
  border-color: var(--muted);
}

input[type="number"]:focus-visible,
select:focus-visible {
  outline: none;
  background: var(--surface);
  border-color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent);
}

input::placeholder {
  color: var(--muted);
  opacity: 0.65;
}

.input-money,
.input-plain {
  position: relative;
  display: flex;
  align-items: center;
}

.input-money > span {
  position: absolute;
  left: 0.85rem;
  color: var(--muted);
  pointer-events: none;
  font-weight: 600;
}

.input-money > input {
  padding-left: 1.8rem;
}

.input-plain > span {
  position: absolute;
  right: 0.8rem;
  color: var(--muted);
  pointer-events: none;
  font-size: 0.9rem;
}

.choice-list {
  display: grid;
  gap: 0.45rem;
}

.choice {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.7rem 0.85rem;
  background: var(--surface-2);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 550;
  color: var(--ink);
  transition: border-color 0.15s, background-color 0.15s;
}

fieldset .field .choice,
fieldset .choice {
  color: var(--ink);
}

.choice:hover {
  border-color: var(--line-strong);
}

.choice:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.choice:has(input:focus-visible) {
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent);
}

.choice input {
  width: 1.2rem;
  height: 1.2rem;
  margin: 0.2rem 0 0;
  accent-color: var(--accent);
  flex: none;
}

.choice small {
  display: block;
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--muted);
}

.more-options {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.2rem 0.9rem;
}

.more-options[open] {
  padding-bottom: 1rem;
}

.more-options > summary {
  cursor: pointer;
  font-weight: 600;
  min-height: 2.75rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  list-style: none;
  color: var(--accent);
  border-radius: 6px;
}

.more-options > summary::-webkit-details-marker {
  display: none;
}

.more-options > summary::before {
  content: "+";
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 1.45rem;
  height: 1.45rem;
  background: var(--accent-soft);
  border-radius: 50%;
  font-weight: 700;
  line-height: 1;
}

.more-options[open] > summary::before {
  content: "−";
}

.more-options > :not(summary) {
  margin-top: 0.9rem;
}

.calc-form > .button {
  min-width: 11rem;
}

@media (max-width: 30rem) {
  .calc-form > .button {
    justify-self: stretch;
  }
}

/* ---------- Result panel ("pay stub") ---------- */

.stub {
  --stub-pad: clamp(1.1rem, 0.7rem + 1.5vw, 1.6rem);
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--stub-pad);
  padding-top: calc(var(--stub-pad) + 6px);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.stub::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 6px;
  background: repeating-linear-gradient(90deg, var(--accent) 0 14px, var(--accent-strong) 14px 28px);
}

.stub:focus-visible {
  outline-offset: 4px;
}

.stub-title {
  display: block;
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  padding-bottom: 0.8rem;
  border-bottom: 1px dashed var(--line-strong);
}

.stub-group {
  margin-top: 1rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.stub-group span {
  text-transform: none;
  letter-spacing: 0;
}

.stub dl {
  margin-top: 0.3rem;
}

.stub-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding-block: 0.5rem;
  border-bottom: 1px dotted var(--line-strong);
}

.stub-row dt {
  min-width: 0;
}

.stub-row dd,
.stub-amount {
  flex: none;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 1rem;
  text-align: right;
}

.stub-detail {
  display: block;
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.stub-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  margin: 1.1rem calc(-1 * var(--stub-pad)) 0.6rem;
  padding: 1rem var(--stub-pad);
  background: var(--accent-soft);
  border-block: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
  font-weight: 650;
}

.stub-total strong {
  margin-left: auto;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: clamp(1.65rem, 1.25rem + 1.6vw, 2.15rem);
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--accent-strong);
}

.stub-facts {
  font-size: 0.95rem;
}

.stub-facts .stub-row:last-child {
  border-bottom: 0;
}

.stub-note {
  margin-top: 0.8rem;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--muted);
}

.stub-alert {
  margin-top: 0.9rem;
  padding: 0.75rem 0.9rem;
  background: var(--notice);
  border-left: 4px solid var(--notice-line);
  border-radius: 6px;
  font-size: 0.925rem;
  line-height: 1.5;
}

/* Pay stub comparison */

.check {
  margin-top: 1rem;
  padding-top: 0.2rem;
  border-top: 1px dashed var(--line-strong);
}

.check-verdict {
  margin-top: 0.8rem;
  padding: 0.75rem 0.9rem;
  border-left: 4px solid var(--accent);
  border-radius: 6px;
  background: var(--accent-softer);
  font-size: 0.925rem;
  line-height: 1.5;
}

.check-verdict.is-short {
  border-left-color: var(--danger);
  background: var(--danger-soft);
}

.check-verdict.is-short strong {
  color: var(--danger);
}

.check-verdict.is-over {
  border-left-color: var(--notice-line);
  background: var(--notice);
}

/* Copy link / copy result / print */

.stub-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.1rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--line-strong);
}

.stub-status {
  flex-basis: 100%;
  font-size: 0.875rem;
  line-height: 1.45;
  color: var(--accent-strong);
  overflow-wrap: anywhere;
}

.stub-status:empty {
  display: none;
}

/* ---------- Tables ---------- */

.table-scroll {
  overflow-x: auto;
  margin-top: 1rem;
}

.table-scroll:focus-visible {
  outline-offset: 2px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
  font-size: 0.95rem;
}

caption {
  text-align: left;
  font-size: 0.875rem;
  color: var(--muted);
  padding-bottom: 0.5rem;
}

th,
td {
  padding: 0.6rem 0.7rem;
  text-align: right;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

th:first-child,
td:first-child {
  text-align: left;
  padding-left: 0;
}

thead th {
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 2px solid var(--line-strong);
}

tbody th {
  font-weight: 550;
}

tfoot th,
tfoot td {
  font-weight: 700;
  border-bottom: 0;
  border-top: 2px solid var(--ink);
}

.stub table {
  font-size: 0.9rem;
}

.stub th,
.stub td {
  padding: 0.45rem 0.5rem;
}

.table-wrap th,
.table-wrap td {
  white-space: normal;
  text-align: left;
  vertical-align: top;
}

.table-wrap td:nth-child(2) {
  min-width: 15rem;
}

.table-wrap td:nth-child(n + 3) {
  white-space: nowrap;
}

.tag {
  display: inline-block;
  margin-left: 0.3rem;
  padding: 0.05rem 0.45rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  vertical-align: 0.1em;
}

/* ---------- Prose ---------- */

.prose {
  max-width: var(--measure);
}

.prose > section,
.prose > aside,
.prose > nav {
  margin-bottom: clamp(2.5rem, 1.5rem + 2.5vw, 3.5rem);
}

.prose h2 {
  font-size: clamp(1.5rem, 1.25rem + 1vw, 1.95rem);
  letter-spacing: -0.01em;
  margin-bottom: 0.9rem;
}

.prose h3 {
  font-size: 1.2rem;
  margin-top: 1.7rem;
  margin-bottom: 0.45rem;
}

.prose p + p,
.prose p + ul,
.prose p + ol,
.prose ul + p,
.prose ol + p,
.prose .formula + p,
.prose .table-scroll + p,
.prose dl + p {
  margin-top: 0.9rem;
}

.prose ul,
.prose ol {
  padding-left: 1.3rem;
}

.prose li + li {
  margin-top: 0.45rem;
}

.prose li::marker {
  color: var(--accent);
  font-weight: 650;
}

.prose-page {
  padding-block: clamp(1.75rem, 1rem + 3vw, 3.25rem);
}

.prose-page h1 {
  margin-bottom: 1.2rem;
}

.prose-page h2 {
  margin-top: 2.4rem;
}

.prose-page .lede {
  margin-top: 0;
  margin-bottom: 1.1rem;
}

.formula {
  margin-block: 1rem;
  padding: 1rem 1.15rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 6px var(--radius) var(--radius) 6px;
  font-family: var(--mono);
  font-size: 0.9rem;
  line-height: 1.55;
  box-shadow: var(--shadow-sm);
}

.formula p + p {
  margin-top: 0.55rem;
}

.formula-name {
  font-family: var(--sans);
  font-weight: 650;
  color: var(--accent-strong);
}

/* Questions */

.faq-item {
  padding-block: 1.15rem;
  border-top: 1px solid var(--line);
}

.faq-item:last-child {
  border-bottom: 1px solid var(--line);
}

.prose .faq-item h3 {
  margin-top: 0;
  font-size: 1.15rem;
}

/* Sources */

.prose .sources {
  list-style: none;
  padding: 0;
  font-size: 0.975rem;
}

.sources li {
  padding: 0.7rem 0 0.7rem 1.6rem;
  border-top: 1px solid var(--line);
  position: relative;
}

.prose .sources li + li {
  margin-top: 0;
}

.sources li::before {
  content: "§";
  position: absolute;
  left: 0.2rem;
  top: 0.7rem;
  color: var(--accent);
  font-family: var(--serif);
  font-weight: 700;
}

.notice {
  padding: 1.15rem 1.3rem;
  background: var(--notice);
  border: 1px solid var(--notice-line);
  border-radius: var(--radius);
}

.prose .notice h2 {
  font-family: var(--sans);
  font-size: 1.05rem;
  letter-spacing: 0;
  margin-bottom: 0.4rem;
}

.notice p {
  font-size: 0.975rem;
}

/* Key facts list (guide) */

.facts {
  display: grid;
  gap: 0.75rem;
}

@media (min-width: 36rem) {
  .facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.facts > div {
  padding: 0.9rem 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}

.facts dt {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.2rem;
}

.facts dd {
  font-size: 0.975rem;
  line-height: 1.45;
}

.guide-cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.9rem 1.5rem;
  max-width: 46rem;
  margin-bottom: clamp(2rem, 1rem + 3vw, 3rem);
  padding: 1.1rem 1.3rem;
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
  border-radius: var(--radius);
}

.guide-cta p {
  flex: 1 1 16rem;
}

/* Inline contents, embed code, change log (text pages) */

.toc-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-block: 1.2rem 0.4rem;
}

.toc-inline a {
  display: inline-flex;
  align-items: center;
  min-height: 2.4rem;
  padding: 0.25rem 0.9rem;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 550;
  text-decoration: none;
}

.toc-inline a:hover {
  background: var(--accent-softer);
  border-color: var(--accent);
}

.snippet {
  display: grid;
  gap: 0.6rem;
  justify-items: start;
  margin-top: 0.9rem;
}

.snippet pre {
  width: 100%;
  margin: 0;
  padding: 1rem 1.1rem;
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  font-family: var(--mono);
  font-size: 0.85rem;
  line-height: 1.55;
}

.snippet code {
  padding: 0;
  background: none;
  border: 0;
  font-size: inherit;
}

.embed-preview {
  display: block;
  width: 100%;
  height: 1180px;
  margin-top: 1rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--paper);
}

.log-entry {
  margin-top: 1.4rem;
  padding: 1.1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.prose .log-entry h3 {
  margin-top: 0;
  font-size: 1.1rem;
}

/* ---------- Cards ---------- */

.card-list {
  list-style: none;
  padding: 0 !important;
  display: grid;
  gap: 0.8rem;
}

@media (min-width: 40rem) {
  .card-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.card-list li + li {
  margin-top: 0;
}

.card {
  display: grid;
  gap: 0.3rem;
  align-content: start;
  height: 100%;
  padding: 1.05rem 1.15rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.card:hover {
  border-color: var(--accent);
  color: var(--ink);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.card-title {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.14rem;
  line-height: 1.25;
  color: var(--accent-strong);
}

.card-text {
  font-size: 0.925rem;
  line-height: 1.5;
  color: var(--muted);
}

.card-meta {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- Home ---------- */

.hero {
  background:
    radial-gradient(60rem 28rem at 88% -10%, var(--accent-soft), transparent 70%),
    linear-gradient(var(--paper-2), var(--paper));
  border-bottom: 1px solid var(--line);
}

.hero-inner {
  display: grid;
  gap: 2.5rem;
  align-items: center;
  padding-block: clamp(2.25rem, 1rem + 5vw, 4.75rem);
}

@media (min-width: 60rem) {
  .hero-inner {
    grid-template-columns: minmax(0, 1.25fr) minmax(19rem, 0.75fr);
    gap: 3.5rem;
  }
}

.hero-text {
  max-width: 40rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.6rem;
}

.trust {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.4rem;
  margin-top: 1.5rem;
  font-size: 0.95rem;
  font-weight: 550;
}

.trust li {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.trust .icon {
  color: var(--accent);
}

.hero-stub {
  max-width: 25rem;
  width: 100%;
  justify-self: center;
}

.stub-demo {
  display: block;
  color: var(--ink);
  text-decoration: none;
  transform: rotate(1.4deg);
  transition: transform 0.25s, box-shadow 0.25s;
}

.stub-demo:hover {
  color: var(--ink);
  transform: rotate(0deg) translateY(-3px);
}

.stub-demo .stub-row > span:first-child {
  min-width: 0;
}

.stub-demo .stub-total {
  margin-bottom: 0;
}

.stub-demo-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  margin: 0 calc(-1 * var(--stub-pad)) calc(-1 * var(--stub-pad));
  padding: 0.8rem var(--stub-pad);
  background: var(--surface-2);
  color: var(--accent);
  font-size: 0.95rem;
  font-weight: 650;
}

.home-section {
  padding-top: clamp(2.5rem, 1.5rem + 3.5vw, 4.25rem);
}

.home-section > h2,
.home-columns h2 {
  font-size: clamp(1.6rem, 1.3rem + 1.2vw, 2.1rem);
  letter-spacing: -0.015em;
  margin-bottom: 1.2rem;
}

.card-list-home {
  gap: 1rem;
}

@media (min-width: 62rem) {
  .card-list-home {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.card-rich {
  gap: 0.35rem;
  padding: 1.35rem 1.4rem 1.2rem;
  grid-template-rows: auto auto auto 1fr auto;
}

.card-icon {
  display: inline-grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  margin-bottom: 0.55rem;
  background: var(--accent-soft);
  color: var(--accent-strong);
  border-radius: 12px;
}

.card-rich .card-title {
  font-size: 1.3rem;
}

.card-more {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.7rem;
  color: var(--accent);
  font-size: 0.925rem;
  font-weight: 650;
}

.card-more .icon {
  transition: transform 0.15s;
}

.card:hover .card-more .icon {
  transform: translateX(3px);
}

.card-guide {
  background: var(--accent-softer);
  border-color: color-mix(in srgb, var(--accent) 22%, var(--line));
}

.card-guide .card-icon {
  background: var(--surface);
}

.stats {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

@media (min-width: 52rem) {
  .stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.stats li {
  display: grid;
  gap: 0.35rem;
  align-content: start;
  padding: 1.3rem 1.25rem;
  background: var(--surface);
}

.stats strong {
  font-family: var(--serif);
  font-size: clamp(1.75rem, 1.4rem + 1.4vw, 2.4rem);
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--accent-strong);
}

.stats span {
  font-size: 0.9rem;
  line-height: 1.4;
  color: var(--muted);
}

.home-columns {
  display: grid;
  gap: 0 4rem;
  padding-top: clamp(2.5rem, 1.5rem + 3.5vw, 4.25rem);
}

.home-columns > .prose {
  max-width: 44rem;
}

@media (min-width: 62rem) {
  .home-columns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .home-columns > .prose {
    margin-bottom: 0;
  }
}

.prose .pick-list {
  list-style: none;
  padding: 0;
}

.pick-list li {
  display: grid;
  gap: 0.15rem;
  padding: 0.9rem 0 0.9rem 1rem;
  border-left: 3px solid var(--accent-soft);
}

.prose .pick-list li + li {
  margin-top: 0.4rem;
}

.pick-list li:hover {
  border-left-color: var(--accent);
}

.pick-list span {
  font-size: 0.975rem;
  color: var(--muted);
}

.question-list {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 0.4rem 2.5rem;
}

.question-list li {
  align-content: start;
}

.question-list strong {
  font-weight: 650;
}

@media (min-width: 48rem) {
  .question-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.prose .rate-answers {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 0.35rem 2rem;
}

.prose .rate-answers li {
  margin: 0;
}

@media (min-width: 40rem) {
  .prose .rate-answers {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.feature-grid {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 1rem;
}

@media (min-width: 36rem) {
  .feature-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 66rem) {
  .feature-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.feature-grid li {
  padding: 1.3rem 1.3rem 1.4rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.feature-icon {
  display: inline-grid;
  place-items: center;
  width: 2.6rem;
  height: 2.6rem;
  margin-bottom: 0.8rem;
  background: var(--gold-soft);
  color: var(--gold);
  border-radius: 50%;
}

.feature-grid h3 {
  font-size: 1.12rem;
  margin-bottom: 0.35rem;
}

.feature-grid p {
  font-size: 0.925rem;
  line-height: 1.5;
  color: var(--muted);
}

.home-disclaimer {
  margin-top: 1.4rem;
  margin-bottom: clamp(1rem, 0.5rem + 2vw, 2rem);
  font-size: 0.9rem;
  color: var(--muted);
}

/* ---------- Footer ---------- */

.site-footer {
  margin-top: clamp(2rem, 1rem + 3vw, 3.5rem);
  padding-block: 3rem 2.5rem;
  background: var(--footer-bg);
  color: var(--footer-ink);
  font-size: 0.95rem;
}

.site-footer a {
  color: var(--footer-ink);
  text-decoration-color: color-mix(in srgb, var(--footer-ink) 35%, transparent);
}

.site-footer a:hover {
  color: #fff;
  text-decoration-color: currentColor;
}

.site-footer :focus-visible {
  outline-color: var(--footer-ink);
}

.footer-grid {
  display: grid;
  gap: 2rem;
}

@media (min-width: 40rem) {
  .footer-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .footer-brand,
  .footer-note {
    grid-column: 1 / -1;
  }
}

@media (min-width: 62rem) {
  .footer-grid {
    grid-template-columns: minmax(0, 1.5fr) repeat(3, minmax(0, 1fr));
    column-gap: 2.5rem;
  }

  .footer-brand {
    grid-column: auto;
  }
}

.footer-brand .brand {
  color: #fff;
  text-decoration: none;
}

.footer-brand .brand-mark {
  background: #fff;
  color: var(--footer-bg);
  box-shadow: none;
}

.footer-brand p {
  margin-top: 0.6rem;
  max-width: 24rem;
  font-size: 0.925rem;
  line-height: 1.55;
  color: var(--footer-muted);
}

.footer-title {
  font-family: var(--sans);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--footer-muted);
  margin-bottom: 0.4rem;
}

.footer-list {
  list-style: none;
  padding: 0;
}

.footer-list a {
  display: inline-flex;
  align-items: center;
  min-height: 2.4rem;
  text-decoration: none;
}

.footer-list a:hover {
  text-decoration: underline;
}

.footer-note {
  padding-top: 1.5rem;
  border-top: 1px solid var(--footer-line);
  font-size: 0.85rem;
  line-height: 1.55;
  color: var(--footer-muted);
}

/* ---------- Embedded calculator (inside an iframe on another site) ---------- */

.embed {
  background: var(--paper);
  padding: 0.75rem;
}

.embed-title {
  font-size: 1.5rem;
  letter-spacing: -0.01em;
  margin: 0.25rem 0 0.8rem;
}

.embed .calc {
  margin-bottom: 0.9rem;
}

.embed-credit {
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--muted);
  text-align: center;
}

/* ---------- Motion and print ---------- */

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
  }

  .stub-demo,
  .stub-demo:hover,
  .card:hover {
    transform: none;
  }
}

@media print {
  .site-header,
  .site-footer,
  .calc-form,
  .related,
  .skip-link,
  .toc,
  .stub-actions,
  .guide-cta .button,
  .hero-actions {
    display: none !important;
  }

  body {
    background: #fff;
  }

  .stub,
  .card,
  .formula,
  .facts > div {
    box-shadow: none;
  }

  .calc > .stub {
    position: relative;
    top: auto;
    max-width: 30rem;
  }

  /* "Print" button on a calculator: only the heading and the result. */
  .print-result .prose,
  .print-result .lede,
  .print-result .page-head .crumbs,
  .print-result .page-head .byline,
  .print-result .page-head .checked {
    display: none !important;
  }
}
