:root {
  color-scheme: light;
  --steel: #1c2430;
  --blue: #1d6fa5;
  --blue-deep: #174c72;
  --orange: #d95d24;
  --orange-ink: #a7431d;
  --orange-light: #ff9b6d;
  --paper: #f5f6f8;
  --page: #fff;
  --rule: #d2dce4;
  --muted: #4b5c6b;
  --blueprint: #182d3e;
  --safety-paper: #fff2e9;
  --display: "Avenir Next Condensed", "Franklin Gothic Medium", "Arial Narrow", system-ui, sans-serif;
  --body: "Avenir Next", system-ui, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-family: var(--body);
  -webkit-text-size-adjust: 100%;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-padding-top: 1.5rem; }
body {
  margin: 0;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--steel);
  font-size: 1rem;
  line-height: 1.6;
}
main { flex: 1; min-width: 0; }
img, svg { display: block; max-width: 100%; }
a { color: var(--blue-deep); text-underline-offset: .18em; }
a:hover { color: var(--orange-ink); }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .52; }
h1, h2, h3 {
  font-family: var(--display);
  margin: 0;
  line-height: 1.06;
  letter-spacing: -.02em;
}
h1 { font-size: clamp(2.4rem, 4.55vw, 4.1rem); font-weight: 700; text-wrap: balance; }
h2 { font-size: clamp(1.7rem, 3vw, 2.45rem); font-weight: 700; }
h3 { font-size: 1.32rem; font-weight: 700; }
p, ul, ol, dl, figure { margin: 0; }
strong { font-weight: 730; }
.shell { width: min(100% - 3rem, 76rem); margin-inline: auto; }
.sr-only, .skip:not(:focus) {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}
.skip:focus {
  position: fixed; inset: .6rem auto auto .6rem; z-index: 10;
  background: #fff; color: var(--blue-deep); padding: .5rem .85rem;
}
.site-header { background: var(--page); border-bottom: 1px solid var(--rule); }
.header-row, .footer-row {
  display: flex; justify-content: space-between; align-items: center;
  gap: .8rem 2rem; min-height: 4.25rem;
}
.brand {
  display: inline-flex; align-items: center; gap: .65rem;
  color: var(--steel); font-weight: 760; font-size: 1.1875rem;
  letter-spacing: -.045em; text-decoration: none;
}
.brand img { flex: 0 0 auto; }
.site-header nav, .site-footer nav { display: flex; align-items: center; flex-wrap: wrap; gap: .45rem 1.7rem; }
.site-header nav a, .site-footer nav a {
  color: var(--steel); font-weight: 630; font-size: .9rem; text-decoration: none;
}
.site-header nav a:hover, .site-footer nav a:hover { color: var(--blue); text-decoration: underline; }
.site-footer { border-top: 1px solid var(--rule); background: var(--page); padding-block: .7rem; }
.site-footer .brand { font-size: 1.07rem; }

.hero { background: var(--steel); color: #f6f9fc; border-bottom: 4px solid var(--blue); }
.hero-inner {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.025fr);
  gap: clamp(2rem, 5.1vw, 5rem); align-items: center;
  padding-block: clamp(2.6rem, 5.5vw, 5.5rem);
}
.eyebrow {
  font: 660 .765rem/1.4 var(--mono);
  text-transform: uppercase; letter-spacing: .085em; color: var(--blue-deep);
}
.hero .eyebrow { color: var(--orange-light); margin-bottom: 1.1rem; }
.hero h1 { font-size: clamp(3.05rem, 5.5vw, 5.15rem); line-height: .96; letter-spacing: -.031em; }
.hero-summary { color: #d0dae3; margin: 1.45rem 0 1.6rem; max-width: 36ch; font-size: clamp(1rem, 1.4vw, 1.15rem); }
.hero-drawing {
  align-self: center; display: block; color: #edf7ff; text-decoration: none;
  border: 1px solid #3d5668; background: var(--blueprint);
}
.hero-drawing:hover { border-color: var(--orange-light); color: #fff; }
.hero-drawing svg, .drawing svg { width: 100%; height: auto; }
.hero-drawing:focus-visible, .hero .button:focus-visible { outline-color: var(--orange-light); }
.hero-result {
  border-top: 1px solid #3d5668;
  padding: .8rem 1.05rem; display: flex; align-items: center; justify-content: space-between; gap: .7rem;
  font-size: .92rem; font-weight: 650;
}
.hero-result small {
  display: block; font: 500 .65rem/1.5 var(--mono); letter-spacing: .04em;
  color: #bfd0dc; margin-bottom: .13rem;
}
.hero-dimension { text-align: right; font-family: var(--mono); white-space: nowrap; color: var(--orange-light); }
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: .8rem;
  min-height: 2.65rem; padding: .48rem .88rem;
  border: 1px solid transparent; border-radius: .2rem;
  font-weight: 690; font-size: .885rem; line-height: 1.25; text-decoration: none;
}
.hero-button { background: var(--orange-light); color: var(--steel); }
.hero-button:hover { background: #ffb28e; color: var(--steel); }
.minor { border-color: var(--rule); background: var(--page); color: var(--blue-deep); }
.minor:hover { border-color: var(--blue); background: #edf6fc; color: var(--blue-deep); }

.home-content { padding-block: clamp(2.25rem, 5vw, 4.5rem); }
.section-title {
  display: flex; justify-content: space-between; flex-wrap: wrap; align-items: end;
  gap: .55rem 1.25rem; margin-bottom: 1.35rem;
}
.section-title p { color: var(--muted); font-size: .95rem; }
.tool-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; border: 1px solid var(--rule); background: var(--rule); }
.tool-link {
  position: relative; display: flex; flex-direction: column; align-items: flex-start;
  background: var(--page); padding: 1.25rem 1.25rem 1.4rem;
  text-decoration: none; color: var(--steel);
}
.tool-link:hover { color: var(--steel); background: #eaf3fa; z-index: 1; }
.tool-link:focus-visible { outline-offset: -3px; z-index: 1; }
.tool-icon { color: var(--blue); padding: .55rem; border: 1px solid #cbdde9; background: #eff6fa; }
.tool-link h3 { margin-top: 1.12rem; font-size: 1.4rem; }
.tool-link p { color: var(--muted); margin-top: .55rem; font-size: .86rem; line-height: 1.55; }
.tool-arrow { position: absolute; inset: 1.2rem 1.3rem auto auto; color: var(--blue-deep); font-family: var(--mono); }
.examples { margin-top: clamp(3.1rem, 7vw, 5.2rem); }
.example-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.8rem 1.3rem; }
.example-group { border-top: 2px solid var(--blue); padding: .8rem 0 0; }
.example-group ul, .related ul, .source-list { list-style: none; padding: 0; margin-top: .65rem; }
.example-group li, .related li { border-bottom: 1px solid var(--rule); }
.example-group a, .related li a {
  display: block; padding: .55rem 0; text-decoration: none; font-size: .88rem; line-height: 1.43;
}
.example-group a:hover, .related li a:hover { text-decoration: underline; }

.calculator-page, .simple-page { padding: 1.35rem 0 clamp(2.75rem, 6vw, 5.2rem); }
.breadcrumbs {
  margin-bottom: clamp(1.35rem, 3vw, 2.45rem); display: flex; flex-wrap: wrap; gap: .25rem .6rem;
  color: var(--muted); font-size: .8125rem; line-height: 1.5;
}
.breadcrumbs a { text-decoration: none; }
.breadcrumbs a:hover { text-decoration: underline; }
.page-heading { margin-bottom: clamp(1.45rem, 3vw, 2rem); }
.page-heading h1 { max-width: 26ch; text-wrap: balance; }
.page-heading .eyebrow { display: flex; align-items: center; gap: .55rem; margin-bottom: .72rem; }
.page-heading .eyebrow svg { width: 1.2rem; height: 1.2rem; }
.page-heading > p:last-child { max-width: 73ch; color: var(--muted); margin-top: .8rem; }
.worksheet { background: var(--page); border: 1px solid var(--rule); border-top: 0; }
.worksheet-bar {
  padding: .64rem 1.12rem; background: var(--steel); color: #eff6fc;
  display: flex; justify-content: space-between; align-items: center; gap: .5rem 1rem;
}
.worksheet-bar > div:first-child { display: flex; align-items: center; gap: .55rem; }
.worksheet-name { font-weight: 670; font-size: .91rem; }
.status-dot { display: block; flex: 0 0 auto; width: .53rem; aspect-ratio: 1; border-radius: 50%; background: var(--orange-light); }
.unit-switch { display: flex; padding: .19rem; gap: .12rem; background: #101822; border: 1px solid #4c5e6f; border-radius: .25rem; }
.unit-switch button {
  background: transparent; border: 0; border-radius: .13rem; color: #e8eff6;
  min-height: 2rem; padding: .28rem .58rem; font-size: .81rem; font-weight: 680;
}
.unit-switch button[aria-pressed="true"] { background: #eff6fc; color: var(--steel); }
.unit-switch button:focus-visible { outline-color: var(--orange-light); }

.quick-result { display: none; }
.worksheet-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.055fr); }
.input-panel { padding: clamp(1.15rem, 2.9vw, 2rem); min-width: 0; }
.print-panel { display: none; }
.input-panel fieldset {
  min-inline-size: 0; padding: 0; margin: 0 0 1.3rem;
  border: 0; border-top: 1px solid var(--rule);
}
fieldset legend {
  max-width: 100%; color: var(--blue-deep); padding: 0 .55rem 0 0;
  font-family: var(--display); font-size: 1.23rem; font-weight: 700;
}
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem .9rem; padding-top: .55rem; }
.field { display: flex; flex-direction: column; gap: .28rem; min-width: 0; }
.field label { color: var(--steel); font-size: .82rem; font-weight: 680; line-height: 1.25; }
.field input, .field select, .share-field input {
  border: 1px solid #b9c8d3; background: white;
  border-radius: .2rem; min-height: 2.58rem;
  width: 100%; min-width: 0; padding: .39rem .48rem;
  font-size: .9rem; line-height: 1.25;
}
.field select { padding-right: .2rem; }
.field input { border: 0; border-radius: .17rem; font-family: var(--mono); font-size: .92rem; }
.number-input { display: flex; align-items: center; border: 1px solid #b9c8d3; border-radius: .2rem; }
.number-input:focus-within { outline: 2px solid var(--blue); outline-offset: 1px; }
.number-input input:focus-visible { outline: 0; }
.number-input:has(input[aria-invalid="true"]) { border-color: var(--orange-ink); }
.number-input input::-webkit-inner-spin-button { appearance: none; }
.field-unit { color: var(--muted); font: 550 .71rem/1.15 var(--mono); padding: 0 .45rem 0 .2rem; white-space: nowrap; }
.field-unit:empty { display: none; }
.field-hint { color: var(--muted); font-size: .735rem; line-height: 1.4; }

.output-panel { min-width: 0; background: #f0f5f9; border-left: 1px solid var(--rule); padding: clamp(.9rem, 2.45vw, 1.5rem); }
.drawing { border: 1px solid #c6d9e6; background: #edf4f9; }
.results { background: var(--page); border: 1px solid var(--rule); border-top: 3px solid var(--blue); margin-top: .9rem; padding: .8rem 1rem 1rem; }
.results-title {
  font: 680 .7rem/1.35 var(--mono); color: var(--blue-deep);
  text-transform: uppercase; letter-spacing: .09em; margin-bottom: .53rem;
}
.primary-result {
  display: grid; grid-template-columns: auto 1fr; align-items: baseline; justify-content: start;
  gap: .05rem .55rem; padding-bottom: .66rem;
}
.result-label { grid-column: 1 / -1; font-size: .92rem; font-weight: 650; }
.primary-result strong { font: 720 clamp(1.75rem, 4.7vw, 2.72rem)/1.1 var(--mono); letter-spacing: -.08em; overflow-wrap: anywhere; }
.result-unit { color: var(--blue-deep); font: 620 .85rem/1.2 var(--mono); }
.result-list > div, [data-print-inputs] > div {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, max-content); gap: .6rem; align-items: baseline;
  padding: .35rem 0; border-top: 1px solid #e0e7ed; font-size: .83rem; line-height: 1.42;
}
.result-list dt { color: var(--muted); }
.result-list dd, [data-print-inputs] dd {
  margin: 0; font: 650 .805rem/1.45 var(--mono); text-align: right; overflow-wrap: anywhere;
}
.result-empty { color: var(--muted); font-size: .88rem; }
.error, .warnings {
  color: #742e10; background: var(--safety-paper); border-inline-start: .2rem solid var(--orange);
  padding: .5rem .68rem; font-size: .81rem;
}
.warnings { margin-top: .6rem; }
.warnings p + p { margin-top: .3rem; }
.error { margin-bottom: .45rem; }

.exports { display: flex; flex-wrap: wrap; gap: .38rem; margin-top: .75rem; }
.exports .button { min-height: 2.4rem; padding: .38rem .61rem; font-size: .79rem; }
.export { background: white; border-color: #c7d5e0; color: var(--blue-deep); }
.export:hover:enabled { border-color: var(--blue); }
.share { background: var(--blue-deep); color: white; }
.share:hover:enabled { background: #163b57; }
.share-field, .export-status { flex: 1 1 100%; font-size: .8rem; color: var(--muted); min-width: 0; }
.share-field input { margin-top: .18rem; }
.worksheet-limit {
  font-size: .82rem; line-height: 1.52; padding: .8rem clamp(1rem, 2.9vw, 2rem);
  border-top: 1px solid var(--rule); background: #fafbfd; color: var(--muted);
}
.worksheet-limit strong { color: var(--steel); }

.reference-grid {
  display: grid; grid-template-columns: minmax(0, 2.5fr) minmax(0, 1fr);
  gap: clamp(1.1rem, 5.5vw, 4.2rem); align-items: start; margin-top: 2.7rem;
}
.article-body > section + section { margin-top: 2.55rem; }
.article-body h2 { margin-bottom: 1rem; }
.article-body h3 { margin-top: 1.45rem; }
.formula-list { border-top: 1px solid var(--rule); }
.formula-list > div { padding: .73rem 0; border-bottom: 1px solid var(--rule); }
.formula-list dt { color: var(--blue-deep); font: 650 .965rem/1.5 var(--mono); overflow-wrap: anywhere; }
.formula-list dd { margin: .24rem 0 0; color: var(--muted); font-size: .92rem; }
.source-list li + li { margin-top: .28rem; }
.source-list a, .back-tool { font-size: .85rem; }
.worked-answer {
  display: flex; gap: .35rem .9rem; justify-content: space-between; flex-wrap: wrap; align-items: baseline;
  padding: .63rem .8rem; background: #e8f1f8; border-left: 3px solid var(--blue);
}
.worked-answer strong { font-family: var(--mono); color: var(--blue-deep); }
.worked ol { padding-left: 1.45em; margin: 1rem 0; }
.worked li { padding-inline-start: .15em; }
.worked li + li { margin-top: .6rem; }
.check { font-size: .92rem; color: var(--muted); }
.related { border-top: 2px solid var(--blue-deep); border-bottom: 1px solid var(--rule); padding: 1.05rem 0 .8rem; }
.related h2 { font-size: 1.46rem; }
.related li:last-child { border-bottom: 0; }
.back-tool { display: block; margin-top: .8rem; font-weight: 650; }
.faq { border-bottom: 1px solid var(--rule); }
.faq details { border-top: 1px solid var(--rule); padding: .62rem .1rem; }
.faq details p { padding: .4rem 0 .35rem 1.18rem; color: var(--muted); font-size: .92rem; }
.faq summary { font-weight: 650; cursor: pointer; }

.simple-content { max-width: 50rem; }
.simple-content h1 { margin: .28rem 0 1rem; }
.simple-content h2 { margin: 1.6rem 0 .55rem; }
.simple-content p + p { margin-top: .8rem; }
.simple-content .button { margin-top: 1.05rem; }

@media (max-width: 66rem) {
  .tool-grid, .example-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero h1 { font-size: clamp(3.05rem, 6vw, 4.8rem); }
  .fields { gap: .75rem .55rem; }
}
@media (max-width: 47.99rem) {
  .shell { width: calc(100% - 2rem); }
  .hero-inner, .worksheet-grid, .reference-grid { grid-template-columns: minmax(0, 1fr); }
  .hero-inner { gap: 1.65rem; }
  .hero h1 { font-size: clamp(3.05rem, 9.8vw, 5rem); }
  .hero-summary { margin: 1.12rem 0 1.25rem; }
  .hero-drawing { max-width: 38rem; }
  .worksheet-bar {
    position: sticky; inset-block-start: 0; z-index: 2; flex-wrap: wrap;
  }
  .quick-result {
    display: grid; flex: 1 1 100%; grid-template-columns: minmax(0, 1fr) auto auto;
    gap: .5rem; align-items: baseline; border-top: 1px solid #4c5e6f; padding-top: .43rem;
    color: #e8eff6; text-decoration: none; font-size: .78rem;
  }
  .quick-result:hover { color: white; }
  .quick-result:focus-visible { outline-color: var(--orange-light); }
  .quick-result strong { color: var(--orange-light); font: 660 .82rem/1.3 var(--mono); }
  #calculator-results { scroll-margin-top: 6rem; }
  .output-panel { border-left: 0; border-top: 1px solid var(--rule); }
  .drawing svg { max-height: 20rem; }
  .reference-grid { gap: 2rem; }
}
@media (max-width: 31rem) {
  .header-row, .footer-row { flex-wrap: wrap; gap: .55rem 1rem; padding-block: .65rem; }
  .site-header nav, .site-footer nav { gap: .45rem 1.05rem; }
  .site-header nav a { font-size: .8375rem; }
  .hero-result { padding: .52rem .68rem; font-size: .78rem; }
  .hero-result small { font-size: .59rem; }
  .tool-link { padding: .85rem .7rem 1rem; }
  .tool-arrow { inset: .85rem .62rem auto auto; }
  .tool-link h3 { font-size: 1.16rem; }
  .tool-link p { font-size: .79rem; }
  .example-grid { gap: 1.5rem .8rem; }
  .example-group a { font-size: .82rem; }
  .worksheet-bar { padding-inline: .72rem; }
  .worksheet-name { font-size: .79rem; }
  .input-panel { padding: .95rem; }
}
@media (prefers-reduced-motion: no-preference) {
  .button, .tool-link, .hero-drawing { transition: background-color .16s ease, border-color .16s ease, color .16s ease; }
}

@page { margin: 12mm; size: auto; }
@media print {
  :root { --rule: #bbb; }
  body { background: white; color: #141414; min-height: auto; font-size: 10pt; display: block; }
  .shell { width: 100%; }
  .site-header, .site-footer, .breadcrumbs, .worksheet-bar, .input-panel, .exports,
  .reference-grid, .skip { display: none !important; }
  .calculator-page, .simple-page { padding: 0; }
  .page-heading { margin: 0 0 .55rem; }
  .page-heading .eyebrow { font-size: 8pt; margin: 0 0 .2rem; }
  .page-heading h1 { font-size: 21pt; max-width: none; }
  .page-heading > p:last-child { margin-top: .28rem; font-size: 9pt; }
  .worksheet { border-top: 1px solid var(--rule); }
  .worksheet-grid { grid-template-columns: .93fr 1.07fr; }
  .print-panel { display: block; padding: .6rem; }
  .print-panel h2 { font-size: 13pt; margin: 0 0 .4rem; }
  .output-panel { background: white; border-left: 1px solid var(--rule); border-top: 0; padding: .55rem; }
  .drawing { break-inside: avoid; }
  .drawing svg { max-height: 158px; }
  .results { margin-top: .38rem; padding: .4rem .5rem; }
  .primary-result strong { font-size: 18pt; }
  .result-list > div, [data-print-inputs] > div { padding: .22rem 0; font-size: 8pt; }
  .result-list dd, [data-print-inputs] dd { font-size: 7.5pt; }
  .worksheet-limit { background: white; padding: .4rem .6rem; font-size: 8pt; }
}
