/* Calcmeister. Colours follow RAL industrial paint: grey white 9002, anthracite 7016,
   signal yellow 1003, traffic blue 5017. One bold element: the yellow rating plate. */
@font-face { font-family: "Barlow"; font-weight: 400; font-display: optional; src: url(fonts/barlow-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 500; font-display: optional; src: url(fonts/barlow-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 600; font-display: optional; src: url(fonts/barlow-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 600; font-display: optional; src: url(fonts/barlow-condensed-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 700; font-display: optional; src: url(fonts/barlow-condensed-latin-700-normal.woff2) format("woff2"); }

:root {
  --paper: #eceeea;
  --sheet: #f7f8f5;
  --ink: #2f3a3f;
  --steel: #5f6b70;
  --rule: #c5ccc8;
  --signal: #f5b301;
  --signal-deep: #c98f00;
  --blue: #00598a;
  --load: #b49e74;
  --warn-bg: #fff4d6;
  --body: "Barlow", system-ui, sans-serif;
  --cond: "Barlow Condensed", "Arial Narrow", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 1.125rem/1.55 var(--body);
  font-variant-numeric: tabular-nums;
}
a { color: var(--blue); text-underline-offset: 0.15em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: #fff; padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; }

/* masthead */
.masthead { background: var(--ink); color: #fff; }
.masthead-inner { display: flex; align-items: center; justify-content: space-between; min-height: 60px; }
.wordmark { display: inline-flex; align-items: center; gap: 10px; color: #fff; text-decoration: none;
  font: 700 1.5rem/1 var(--cond); letter-spacing: 0.01em; }
.mark { width: 28px; height: 28px; }
.mark rect { fill: var(--signal); stroke: none; }
.mark path { stroke: var(--ink); stroke-width: 2.6; stroke-linecap: round; fill: none; }
.masthead nav { display: flex; gap: 22px; }
.masthead nav a { color: #fff; font-weight: 500; text-decoration: none; }
.masthead nav a:hover { text-decoration: underline; }

main.wrap { padding-top: 36px; padding-bottom: 64px; }

/* type */
h1, h2, h3 { font-family: var(--cond); font-weight: 700; line-height: 1.08; margin: 0; }
h1 { font-size: clamp(2.1rem, 4.6vw, 3.2rem); max-width: 22ch; }
h2 { font-size: 1.75rem; margin-top: 2.2em; margin-bottom: 0.5em; }
p { margin: 0 0 1em; }
.lede { font-size: 1.25rem; color: var(--steel); max-width: 60ch; margin-top: 0.6em; }
.crumbs { font-size: 0.95rem; color: var(--steel); margin-bottom: 14px; }
.crumbs a { color: var(--steel); }

/* the bench: inputs left, readout right */
.bench { display: grid; gap: 28px; margin-top: 28px; align-items: start; }
@media (min-width: 880px) {
  .bench { grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 40px; }
  .readout { position: sticky; top: 20px; }
}

.inputs { background: var(--sheet); border: 1px solid var(--rule); border-radius: 6px; padding: 22px; display: grid; gap: 18px; }
.field label { display: block; font-weight: 600; margin-bottom: 6px; }
.control { display: flex; align-items: stretch; }
.control input, .control select {
  flex: 1; min-width: 0; height: 46px; padding: 0 12px; font: inherit; color: var(--ink);
  background: #fff; border: 1.5px solid #8d989c; border-radius: 4px;
}
.control input { text-align: right; }
.control:has(.unit) input, .control:has(.unit) select { border-radius: 4px 0 0 4px; }
.control .unit {
  display: flex; align-items: center; min-width: 58px; justify-content: center; padding: 0 10px;
  background: var(--paper); border: 1.5px solid #8d989c; border-left: 0; border-radius: 0 4px 4px 0;
  color: var(--steel); font-weight: 500;
}
.control select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%);
  background-position: calc(100% - 18px) 20px, calc(100% - 12px) 20px; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 32px; }
.control input[aria-invalid="true"] { border-color: #b3261e; }
.help { font-size: 0.95rem; color: var(--steel); margin: 6px 0 0; }
.error { font-size: 0.95rem; color: #b3261e; margin: 6px 0 0; font-weight: 500; }

/* the rating plate */
.plate {
  position: relative; background: var(--signal); color: var(--ink); border-radius: 6px;
  padding: 26px 30px 22px; box-shadow: inset 0 0 0 2px var(--signal-deep), inset 0 0 0 7px var(--signal), inset 0 0 0 8px rgba(47, 58, 63, 0.35);
}
.screw { position: absolute; width: 12px; height: 12px; border-radius: 50%; background: #d9dcd6;
  box-shadow: inset 0 0 0 1.5px #8d989c; }
.screw::after { content: ""; position: absolute; left: 2px; right: 2px; top: 5px; height: 1.5px; background: #6e7a7e; transform: rotate(-35deg); }
.screw:nth-child(1) { top: 12px; left: 12px; }
.screw:nth-child(2) { top: 12px; right: 12px; }
.screw:nth-child(3) { bottom: 12px; left: 12px; }
.screw:nth-child(4) { bottom: 12px; right: 12px; }
.plate dl { margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 18px; }
.plate .out dt { font-size: 0.95rem; font-weight: 600; }
.plate .out dd { margin: 2px 0 0; font: 600 1.6rem/1.1 var(--cond); }
.plate .out dd .unit { font: 500 1rem var(--body); }
.plate .out.primary { grid-column: 1 / -1; padding-bottom: 12px; border-bottom: 1.5px solid rgba(47, 58, 63, 0.35); }
.plate .out.primary dd { font: 700 clamp(3.2rem, 9vw, 4.6rem)/0.95 var(--cond); letter-spacing: -0.01em; }
.plate .out.primary dd .unit { font: 600 1.6rem var(--cond); }
@media (max-width: 480px) { .plate dl { grid-template-columns: repeat(2, minmax(0, 1fr)); } .plate { padding: 24px 22px 20px; } }

.diagram { display: block; width: 100%; height: auto; margin-top: 16px; background: var(--sheet); border: 1px solid var(--rule); border-radius: 6px; }
.diagram .load { fill: var(--load); stroke: #8a7650; stroke-width: 1; }
.diagram .belt { fill: none; stroke: var(--ink); stroke-width: 4; stroke-linejoin: round; stroke-linecap: round; }
.diagram .roll { stroke: #8d989c; stroke-width: 9; stroke-linecap: round; }
.diagram .dim { stroke: var(--steel); stroke-width: 1; }
.diagram .dimtext { fill: var(--steel); font: 500 12px var(--body); }

.warnings { list-style: none; margin: 14px 0 0; padding: 0; }
.warnings li, .warn { background: var(--warn-bg); border-left: 4px solid var(--signal-deep); padding: 10px 14px; margin-bottom: 8px; font-size: 1rem; }

/* article */
.explain { max-width: 68ch; margin-top: 12px; }
.explain h2:first-child { margin-top: 2em; }
.formula { background: var(--sheet); border: 1px solid var(--rule); border-left: 4px solid var(--ink); border-radius: 4px; padding: 14px 20px; margin: 0 0 1em; overflow-x: auto; }
.formula p { margin: 0.25em 0; white-space: nowrap; font-size: 1.1rem; }
var { font-style: italic; }
.symbols { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 0 0 1em; }
.symbols dt { font-weight: 600; }
.symbols dd { margin: 0; }
table { border-collapse: collapse; width: 100%; margin: 0 0 1em; font-size: 1rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--rule); }
th { font-weight: 600; border-bottom: 2px solid var(--ink); }
.note { font-size: 1rem; color: var(--steel); }

.faq { max-width: 68ch; }
.faq details { border-bottom: 1px solid var(--rule); }
.faq summary { cursor: pointer; padding: 14px 0; font-weight: 600; list-style: none; display: flex; justify-content: space-between; gap: 16px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font: 600 1.4rem/1 var(--cond); color: var(--steel); }
.faq details[open] summary::after { content: "−"; }
.faq details p { margin: 0 0 16px; }

.related ul { padding-left: 1.2em; }
.meta { font-size: 0.95rem; color: var(--steel); max-width: 68ch; margin-top: 2.5em; }

.ad-slot { margin: 32px 0; min-height: 100px; }

/* home */
.hero { padding: 24px 0 8px; }
.group h2 { margin-top: 1.6em; }
.toollist { list-style: none; margin: 0; padding: 0; border-top: 2px solid var(--ink); }
.toollist a { display: block; padding: 16px 0; border-bottom: 1px solid var(--rule); color: var(--ink); text-decoration: none; }
.toollist strong { display: block; font: 700 1.4rem/1.2 var(--cond); color: var(--blue); }
.toollist span { display: block; color: var(--steel); max-width: 70ch; }
.toollist a:hover strong { text-decoration: underline; }

/* legal pages */
.legal { max-width: 68ch; }
.legal h1 { margin-bottom: 0.5em; }
.legal h2 { font-size: 1.4rem; margin-top: 1.8em; }
.legal address { font-style: normal; }

/* footer */
.foot { border-top: 1px solid var(--rule); background: var(--sheet); font-size: 0.95rem; color: var(--steel); }
.foot-inner { display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; padding-top: 20px; padding-bottom: 20px; }
.foot p { margin: 0; }
.foot nav { display: flex; gap: 18px; }
.foot a { color: var(--steel); }

/* mobile: the main result stays in view while you type */
.result-bar { display: none; }
@media (max-width: 879px) {
  .result-bar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; align-items: baseline; justify-content: space-between;
    gap: 12px; padding: 10px 20px calc(10px + env(safe-area-inset-bottom)); background: var(--signal); color: var(--ink);
    border-top: 2px solid var(--signal-deep); font-weight: 600; }
  .result-bar[hidden] { display: none; }
  .result-bar strong { font: 700 1.8rem/1 var(--cond); }
  body.has-bar { padding-bottom: 64px; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
