:root {
  --paper: #e8ecee;      /* stainless: the page */
  --card: #ffffff;
  --ink: #22292f;        /* slate */
  --muted: #4d575f;
  --line: #c9d0d5;
  --rail: #8b959d;       /* ticket rail, section rails */
  --ticket: #fffdf7;     /* thermal paper: only the results */
  --ticket-line: #d9d2c2;
  --accent: #2f5d3a;
  --accent-ink: #ffffff;
  --accent-soft: #e6eee4;
  --error: #a3231a;
  --error-soft: #fbeceb;
  --focus: #1d5fbf;
  --radius: 8px;
  --display: "Avenir Next Condensed", "Roboto Condensed", "Arial Narrow", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 17px; line-height: 1.5;
}
.wrap { max-width: 980px; margin: 0 auto; padding: 20px 16px 48px; }
header { margin-bottom: 18px; }
.eyebrow { margin: 0 0 2px; font-size: 15px; font-weight: 600; color: var(--muted); }
/* Headings set like lettering on a kitchen equipment plate: condensed, heavy, capitals. */
h1 {
  margin: 0; font-family: var(--display); font-stretch: condensed; font-weight: 700;
  font-size: 30px; line-height: 1.05; text-transform: uppercase; letter-spacing: .01em;
}
.lede { margin: 8px 0 0; color: var(--muted); }

.tool { display: grid; gap: 16px; grid-template-columns: 1fr; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 16px; }
.panel h2 { margin: 0 0 4px; font-size: 18px; }

/* The one bold element: results print on a kitchen ticket hanging from a steel rail. */
.panel.results {
  position: relative; margin-top: 10px; padding-top: 22px; padding-bottom: 26px;
  background: var(--ticket); border: 0; border-radius: 0;
  box-shadow: 0 1px 1px rgba(34, 41, 47, .12), 0 10px 18px -12px rgba(34, 41, 47, .45);
}
.panel.results::before {  /* the rail, gripping the top edge */
  content: ""; position: absolute; top: -10px; left: -8px; right: -8px; height: 14px;
  border-radius: 3px; background: linear-gradient(#b9c1c7, var(--rail) 55%, #6f7880);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .6) inset, 0 2px 3px rgba(34, 41, 47, .25);
}
.panel.results::after {  /* torn bottom edge */
  content: ""; position: absolute; left: 0; right: 0; bottom: -7px; height: 8px;
  background: linear-gradient(-45deg, transparent 5px, var(--ticket) 0) 0 0 / 10px 8px repeat-x,
              linear-gradient(45deg, transparent 5px, var(--ticket) 0) 0 0 / 10px 8px repeat-x;
}
.panel.results h2 {
  font-family: var(--display); font-stretch: condensed; font-weight: 700; font-size: 17px;
  text-transform: uppercase; letter-spacing: .04em; padding-bottom: 10px; border-bottom: 2px solid var(--ink);
}
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { float: left; width: 100%; padding: 0; font-weight: 700; font-size: 16px; margin: 0 0 10px; }
legend + * { clear: both; }
.group + .group { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.hint { margin: -4px 0 12px; font-size: 14.5px; color: var(--muted); }
.hint.after-rows { margin: 12px 0 0; }
.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 600; margin-bottom: 6px; }
.opt, .unit-lbl { font-weight: 400; color: var(--muted); }
.opt { font-size: 14px; }
.control { position: relative; }
.control .prefix { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; font-size: 18px; }
input, select {
  width: 100%; min-height: 52px; padding: 12px 14px;
  font: inherit; font-size: 19px; color: var(--ink); background: #fff;
  border: 1.5px solid var(--line); border-radius: 6px;
}
input { -webkit-appearance: none; appearance: none; }
select { cursor: pointer; }
input.has-prefix { padding-left: 32px; }
input:hover, select:hover { border-color: var(--rail); }
input:focus, select:focus { outline: 3px solid var(--focus); outline-offset: 1px; border-color: var(--focus); }
input[aria-invalid="true"], select[aria-invalid="true"] { border-color: var(--error); background: var(--error-soft); }
.err { margin: 6px 0 0; color: var(--error); font-size: 14.5px; font-weight: 500; }
.err:empty { display: none; }
.row2 { display: grid; grid-template-columns: 1fr; gap: 0 12px; }

button {
  min-height: 48px; padding: 10px 20px; font: inherit; font-weight: 600;
  border-radius: 6px; cursor: pointer; background: #fff; color: var(--ink); border: 1.5px solid var(--ink);
}
button:hover { background: var(--paper); }
button:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.actions { margin-top: 18px; }

.placeholder { margin: 8px 0 0; color: var(--muted); }
.stats { margin: 8px 0 0; padding: 0; list-style: none; }
.stat {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 12px;
  padding: 13px 0; border-top: 1px solid var(--line);
}
.results .stat { border-top: 1px dashed var(--ticket-line); }
.stat:first-child, .stat.hero + .stat { border-top: 0; }
.stat .k { color: var(--muted); font-size: 15.5px; }
.stat .v {
  font-variant-numeric: tabular-nums; font-weight: 700; font-size: 22px;
  margin-left: auto; text-align: right; min-width: 0; max-width: 100%; overflow-wrap: break-word;
}
.stat .v small { font-size: 14px; font-weight: 500; color: var(--muted); margin-left: 4px; }
.stat.hero { padding: 14px 0 16px; border-bottom: 2px solid var(--ink); }
.stat.hero .k { color: var(--ink); font-weight: 600; }
.stat.hero .v { font-size: clamp(28px, 8.4vw, 40px); font-weight: 800; letter-spacing: -.01em; }
.stat.key .v { color: var(--accent); font-size: 26px; }
.subhead { margin: 18px 0 0; padding-top: 14px; border-top: 2px solid var(--ink); font-weight: 700; font-size: 15px; }
.stat.line .k { color: var(--ink); min-width: 0; overflow-wrap: anywhere; }
.stat.line .v { font-size: 18px; }
.stat.line .v small { overflow-wrap: anywhere; }
[hidden] { display: none !important; }

.note { margin: 12px 0 0; padding: 10px 12px; font-size: 15px; background: var(--accent-soft); border-radius: 6px; }
.note.loss { color: var(--error); background: var(--error-soft); }
.field > .hint { margin: 6px 0 0; }
.row { padding-bottom: 6px; }
.row + .row { border-top: 1px dashed var(--line); padding-top: 10px; }
.row-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 48px; margin-bottom: 6px; }
.row-head h3 { margin: 0; font-size: 15.5px; }
.row-head button { border-color: var(--line); font-size: 15px; padding: 8px 14px; }
.cells { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 0 12px; }
.cells label { font-size: 15.5px; }

a { color: var(--accent); }
a:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.home { display: inline-flex; align-items: center; min-height: 44px; font-size: 15px; font-weight: 600; }
.links { list-style: none; margin: 0; padding: 0; }
.links li + li { border-top: 1px solid var(--line); }
.links a { display: flex; flex-direction: column; justify-content: center; gap: 2px; min-height: 56px; padding: 10px 0; font-weight: 600; text-decoration: none; }
.links a:hover { text-decoration: underline; text-underline-offset: 3px; }
.links span { color: var(--muted); font-size: 15px; font-weight: 400; }
.related { margin-top: 32px; max-width: 680px; }
.related h2, .hub h2, .toc h2, .more-in h2 {
  display: flex; align-items: center; gap: 14px; margin: 30px 0 6px;
  font-family: var(--display); font-stretch: condensed; font-weight: 700; font-size: 20px;
  text-transform: uppercase; letter-spacing: .03em;
}
.related h2::after, .hub h2::after, .toc h2::after, .more-in h2::after {
  content: ""; flex: 1; height: 6px; border-radius: 3px;
  background: linear-gradient(#b9c1c7, var(--rail) 55%, #6f7880);
}

article { margin-top: 32px; max-width: 680px; }
article h2 { font-size: 21px; margin: 28px 0 8px; }
article p { margin: 0 0 12px; }
.formula {
  display: block; padding: 14px 16px; margin: 0 0 12px; background: var(--card);
  border: 1px solid var(--line); border-left: 4px solid var(--rail); border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 15px; overflow-wrap: anywhere;
}
article ul { padding-left: 20px; margin: 0 0 12px; }
article li { margin-bottom: 6px; }
footer { margin-top: 32px; font-size: 14px; color: var(--muted); }

/* Top bar on every page: the name, which links home, and a search box that is always open. */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.topbar { background: var(--ink); border-bottom: 3px solid var(--rail); }
.topbar-in {
  max-width: 980px; margin: 0 auto; padding: 8px 16px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 24px;
}
.topbar .home {
  color: #fff; text-decoration: none; font-family: var(--display); font-stretch: condensed;
  font-weight: 700; font-size: 22px; text-transform: uppercase; letter-spacing: .05em;
}
.topbar .home:hover { text-decoration: underline; text-underline-offset: 4px; }
.topbar .home:focus-visible { outline-color: #fff; }
.find { position: relative; flex: 1 1 220px; max-width: 440px; margin-left: auto; }
.find input {
  min-height: 44px; padding: 8px 14px 8px 40px; font-size: 16px; border-color: transparent;
}
.find input:focus { outline-color: #8fb3ea; }
.find::before, .find::after { content: ""; position: absolute; z-index: 1; pointer-events: none; }
.find::before { left: 14px; top: 13px; width: 10px; height: 10px; border: 2.2px solid var(--muted); border-radius: 50%; }  /* magnifier lens */
.find::after { left: 26px; top: 26px; width: 2.2px; height: 7px; background: var(--muted); border-radius: 1px; transform: rotate(-45deg); }  /* handle */
.find input::-webkit-search-cancel-button { -webkit-appearance: none; }
.find-results {
  position: absolute; z-index: 10; top: calc(100% + 6px); left: 0; right: 0;
  list-style: none; margin: 0; padding: 6px 0; background: var(--card);
  border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 14px 28px -12px rgba(34, 41, 47, .5);
}
.find-results a {
  display: flex; flex-direction: column; justify-content: center; min-height: 48px; padding: 6px 14px;
  color: var(--ink); font-weight: 600; text-decoration: none;
}
.find-results a span { font-size: 14px; font-weight: 400; color: var(--muted); }
.find-results a:hover, .find-results a:focus { background: var(--accent-soft); }
.find-results a:focus-visible { outline-offset: -3px; }
.find-results .none { padding: 6px 14px; color: var(--muted); font-size: 15px; }
.find-results .none a { display: inline-flex; min-height: 44px; padding: 0; color: var(--accent); }

/* Hub: categories packed into columns so the whole list fits in about a screen on desktop. */
.cats { columns: 270px 3; column-gap: 36px; }
.cats section { break-inside: avoid; padding-top: 22px; }
.hub .cats h2 { margin-top: 0; }
.cats .links a { min-height: 48px; padding: 7px 0; }
.cats .links span { font-size: 14.5px; }
.hub h2 .ic { flex: none; width: 24px; height: 24px; margin-right: -4px; color: var(--accent); }
.all-h { margin-top: 36px; }
.cats h2::after { display: none; }  /* the icon marks each category; rails stay on the two main headings */

/* Hub: common jobs as short, ordered paths through the calculators. */
.jobs { margin-top: 26px; }
.job-grid { display: grid; gap: 10px; grid-template-columns: 1fr; }
.job { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--rail); border-radius: 4px; padding: 10px 14px 6px; }
.job h3 { margin: 0; font-size: 17px; }
.job p { display: none; margin: 2px 0 4px; font-size: 14.5px; color: var(--muted); }
.job ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; align-items: center; column-gap: 8px; }
.job li { display: flex; align-items: center; gap: 8px; }
.job li:not(:last-child)::after { content: "\2192" / ""; color: var(--muted); }  /* arrow ends a line, so a wrapped step starts with its link */
.job a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; font-size: 15.5px; }
@media (min-width: 560px) { .job-grid { grid-template-columns: 1fr 1fr; } .job p { display: block; } }
@media (min-width: 900px) { .job-grid { grid-template-columns: repeat(3, 1fr); } }

/* Calculator pages: breadcrumb, update line, worked-example button, contents and same-category list. */
.crumbs { display: flex; flex-wrap: wrap; align-items: center; column-gap: 8px; font-size: 15px; }
.crumbs a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; }
.crumbs .sep { color: var(--rail); }
.updated { margin: 10px 0 0; font-size: 14px; color: var(--muted); }
.try { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin: 0 0 16px; }
#try-example { min-height: 44px; padding: 8px 14px; font-size: 15px; color: var(--accent); border-color: var(--accent); }
#try-example:hover { background: var(--accent-soft); }
.example-note { font-size: 14px; color: var(--muted); }
.example-note:empty { display: none; }
.reading { margin-top: 32px; }
.reading article { margin-top: 0; }
.toc { max-width: 680px; margin-bottom: 8px; }
.toc h2, .more-in h2 { margin-top: 0; }
.toc ul { list-style: none; margin: 0; padding: 0; }
.toc li + li { border-top: 1px solid var(--line); }
.toc a { display: flex; align-items: center; min-height: 44px; padding: 4px 0; font-size: 15.5px; font-weight: 600; text-decoration: none; }
.toc a:hover { text-decoration: underline; text-underline-offset: 3px; }
.more-in { max-width: 680px; margin-top: 32px; }
.share { margin-top: 16px; padding-top: 12px; border-top: 1px dashed var(--ticket-line); }
#copy-link { min-height: 44px; padding: 8px 14px; font-size: 15px; background: transparent; }
#copy-link:hover { background: var(--paper); }
#copy-url { margin-top: 10px; min-height: 44px; padding: 8px 12px; font-size: 16px; background: #fff; }
.copy-note { margin: 8px 0 0; font-size: 14px; color: var(--muted); }
.copy-note:empty { display: none; }

.no-match { margin: 24px 0 0; padding: 14px 16px; background: var(--card); border: 1px solid var(--line); border-radius: 6px; }
.more { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; }

@media (min-width: 560px) { .row2 { grid-template-columns: 1fr 1fr; } }
@media (min-width: 820px) {
  .wrap { padding: 40px 24px 64px; }
  h1 { font-size: 44px; }
  .tool { grid-template-columns: 1.1fr 1fr; align-items: start; }
  .panel { padding: 24px; }
  .panel.results { padding-top: 28px; position: sticky; top: 24px; }
  .links a { display: grid; grid-template-columns: minmax(0, 20rem) 1fr; align-items: baseline; gap: 4px 28px; }
  .related .links a, .cats .links a, .more-in .links a { display: flex; }
  .reading { display: grid; grid-template-columns: minmax(0, 1fr) 250px; column-gap: 48px; align-items: start; }
  .reading article { grid-column: 1; grid-row: 1 / span 2; }
  .reading article > h2:first-child { margin-top: 0; }
  .toc { grid-column: 2; grid-row: 1; margin: 0; }
  .more-in { grid-column: 2; grid-row: 2; margin-top: 28px; }
  .toc h2, .more-in h2 { font-size: 17px; }
  .topbar-in { padding: 8px 24px; }
}
