/* Stallwright: a workbench reference desk.
   One hue family (145 degrees), six colour tokens, slab headings, two-pane lists. */

:root {
  --ink: #11271a;
  --paper: #f2f8f4;
  --pane: #dde9e2;
  --moss: #215e3b;
  --muted: #40594a;
  --rule: #678373;

  --font-head: Rockwell, Cambria, Georgia, serif;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  --gutter: 16px;
  --wrap: 1180px;
  color-scheme: light;
}

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

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  line-height: 1.6;
  overflow-wrap: break-word;
}

main {
  flex: 1 0 auto;
  display: block;
}

main:focus {
  outline: none;
}

h1,
h2,
h3 {
  font-family: var(--font-head);
  color: var(--ink);
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 0.6em;
  text-wrap: balance;
}

h1 {
  font-size: clamp(2rem, 1.25rem + 3.2vw, 3.4rem);
  line-height: 1.08;
  letter-spacing: -0.01em;
}

h2 {
  font-size: clamp(1.5rem, 1.15rem + 1.6vw, 2.2rem);
}

h3 {
  font-size: clamp(1.2rem, 1.05rem + 0.6vw, 1.5rem);
}

p {
  margin: 0 0 1em;
  max-width: 68ch;
}

ul,
ol {
  margin: 0 0 1em;
  padding-left: 1.25em;
  max-width: 68ch;
}

li + li {
  margin-top: 0.4em;
}

a {
  color: var(--moss);
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  transition: color 150ms ease, background-color 150ms ease, border-color 150ms ease;
}

a:hover {
  color: var(--ink);
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: 3px solid var(--moss);
  outline-offset: 3px;
}

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -4rem;
  z-index: 10;
  padding: 10px 14px;
  background-color: var(--moss);
  color: var(--paper);
  font-weight: 700;
  text-decoration: none;
}

.skip-link:focus {
  top: 8px;
  outline: 3px solid var(--ink);
  outline-offset: 2px;
}

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* Header and navigation */

.site-header {
  background-color: var(--paper);
  border-bottom: 3px solid var(--ink);
}

.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  padding-block: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
}

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

.brand-mark {
  width: 40px;
  height: 40px;
  flex: none;
}

.mark-stick {
  fill: var(--moss);
}

.mark-notch {
  fill: none;
  stroke: var(--paper);
  stroke-width: 2.5;
  stroke-linecap: round;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-family: var(--font-head);
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1.1;
}

.brand-tag {
  font-size: 0.82rem;
  line-height: 1.3;
  color: var(--muted);
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 6px;
  list-style: none;
  margin: 0;
  padding: 0;
  max-width: none;
}

.site-nav li + li {
  margin-top: 0;
}

.site-nav a {
  display: inline-block;
  padding: 8px 10px;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 3px solid transparent;
}

.site-nav a:hover {
  color: var(--moss);
  border-bottom-color: var(--rule);
}

.site-nav a[aria-current="page"] {
  color: var(--moss);
  font-weight: 700;
  border-bottom-color: var(--moss);
}

/* Hero and ruler */

.hero {
  padding-block: clamp(36px, 7vw, 68px) clamp(24px, 4vw, 40px);
  border-bottom: 1px solid var(--rule);
}

.eyebrow {
  margin: 0 0 14px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.lede {
  max-width: 46rem;
  font-size: clamp(1.15rem, 1.02rem + 0.65vw, 1.4rem);
  line-height: 1.5;
}

.hero h1 {
  max-width: 17ch;
}

.ruler {
  display: block;
  width: 100%;
  height: 28px;
  margin-top: clamp(28px, 5vw, 48px);
}

.ruler-band {
  fill: url(#ruler-ticks);
}

.tick {
  fill: none;
  stroke: var(--rule);
  stroke-width: 1.5;
}

.tick-base {
  fill: none;
  stroke: var(--ink);
  stroke-width: 2;
}

.notice {
  max-width: 46rem;
  padding: 14px 16px;
  background-color: var(--pane);
  border-left: 4px solid var(--moss);
}

/* Sections and the two-pane workbench */

.desk,
.band {
  padding-block: clamp(40px, 6vw, 72px);
}

.band {
  border-top: 2px solid var(--ink);
}

.section-intro {
  max-width: 62ch;
}

.workbench {
  display: grid;
  border: 2px solid var(--ink);
  background-color: var(--paper);
}

.workbench-index {
  min-width: 0;
  background-color: var(--pane);
  border-bottom: 2px solid var(--ink);
}

.workbench-detail {
  min-width: 0;
  padding: clamp(20px, 3.4vw, 40px);
}

@media (min-width: 760px) {
  .workbench {
    grid-template-columns: minmax(16rem, 21rem) minmax(0, 1fr);
  }

  .workbench-index {
    border-bottom: 0;
    border-right: 2px solid var(--ink);
  }
}

.pane-label {
  margin: 0;
  max-width: none;
  padding: 16px 16px 12px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--rule);
}

.index-list {
  margin: 0;
  padding: 0;
  max-width: none;
  list-style: none;
}

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

.index-list a {
  display: grid;
  grid-template-columns: 2.5rem minmax(0, 1fr);
  gap: 4px 10px;
  padding: 14px 16px;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
}

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

.index-list a:focus-visible {
  outline-offset: -3px;
}

.index-list a[aria-current="true"] {
  background-color: var(--moss);
  color: var(--paper);
}

.index-list a[aria-current="true"]:focus-visible {
  outline-color: var(--paper);
}

.item-num {
  padding-top: 0.15em;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--moss);
}

.index-list a[aria-current="true"] .item-num,
.index-list a[aria-current="true"] .item-deck {
  color: var(--paper);
}

.item-text {
  display: block;
  min-width: 0;
}

.item-title {
  display: block;
  font-weight: 700;
  line-height: 1.3;
}

.item-deck {
  display: block;
  margin-top: 2px;
  font-size: 0.9rem;
  line-height: 1.4;
  color: var(--muted);
}

.status-line {
  max-width: none;
  margin: 0 0 20px;
  padding: 0 0 12px;
  font-size: 0.92rem;
  color: var(--muted);
  border-bottom: 1px solid var(--rule);
}

.note {
  max-width: 66ch;
  animation: note-in 240ms ease-out;
}

.note h3 {
  margin-bottom: 0.7em;
  font-size: clamp(1.45rem, 1.1rem + 1.2vw, 2rem);
}

.kicker {
  margin: 0 0 6px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

@keyframes note-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

/* Principles row */

.principles {
  display: grid;
  gap: 28px;
  margin: 0;
  padding: 0;
  max-width: none;
  list-style: none;
}

.principles li {
  padding-top: 16px;
  border-top: 3px solid var(--moss);
}

.principles li + li {
  margin-top: 0;
}

.principles h3 {
  font-size: 1.25rem;
}

@media (min-width: 760px) {
  .principles {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 32px;
  }
}

.fine-print {
  margin-top: 28px;
  font-size: 0.9rem;
  color: var(--muted);
}

/* Converter */

.family h2 {
  margin-bottom: 0.5em;
}

.converter {
  margin: 0 0 8px;
  max-width: none;
}

.fields {
  display: grid;
  gap: 16px;
  min-width: 0;
  margin: 0 0 14px;
  padding: 0;
  border: 0;
}

.fields legend {
  padding: 0;
  margin-bottom: 12px;
  font-family: var(--font-head);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--ink);
}

@media (min-width: 560px) {
  .fields {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: end;
  }
}

.field {
  min-width: 0;
}

.field label {
  display: block;
  margin-bottom: 6px;
  font-weight: 700;
}

.field input,
.field select {
  display: block;
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  font: inherit;
  font-size: 1.1rem;
  color: var(--ink);
  background-color: var(--paper);
  border: 2px solid var(--rule);
  border-radius: 0;
}

.hint {
  margin: 0 0 16px;
  font-size: 0.92rem;
  color: var(--muted);
}

.result-summary {
  min-height: 3.2em;
  max-width: none;
  margin: 0 0 20px;
  padding: 14px 16px;
  font-size: 1.05rem;
  line-height: 1.5;
  background-color: var(--pane);
  border-left: 4px solid var(--moss);
  overflow-wrap: anywhere;
}

.results {
  margin: 0;
  padding: 0;
  max-width: none;
  list-style: none;
  border-top: 2px solid var(--ink);
}

.results li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 4px 16px;
  padding: 12px 10px;
  border-bottom: 1px solid var(--rule);
}

.results li + li {
  margin-top: 0;
}

.results li.is-source {
  background-color: var(--pane);
}

.result-name {
  min-width: 0;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.result-symbol {
  margin-left: 4px;
  font-weight: 400;
  font-size: 0.92rem;
  color: var(--muted);
  white-space: nowrap;
}

.result-value {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
  overflow-wrap: anywhere;
}

.results li.is-source .result-value {
  font-weight: 700;
}

.ref-list {
  margin: 0 0 16px;
  max-width: none;
}

.ref-row {
  display: grid;
  gap: 4px 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--rule);
}

@media (min-width: 640px) {
  .ref-row {
    grid-template-columns: minmax(10rem, 14rem) minmax(0, 1fr);
  }
}

.ref-list dt {
  font-weight: 700;
}

.ref-list dd {
  margin: 0;
}

.formula {
  max-width: 60ch;
  margin: 0 0 14px;
  padding: 12px 16px;
  font-family: var(--font-mono);
  font-size: 1rem;
  background-color: var(--pane);
  border-left: 4px solid var(--moss);
  overflow-wrap: anywhere;
}

.balance {
  display: block;
  width: min(100%, 220px);
  height: auto;
  margin: 0 0 24px;
}

.balance-beam,
.balance-post,
.balance-base,
.balance-string {
  fill: none;
  stroke: var(--ink);
  stroke-width: 3;
  stroke-linecap: round;
}

.balance-pan {
  fill: var(--moss);
}

.balance-pivot {
  fill: var(--ink);
}

/* Field guide */

.guide {
  display: grid;
  gap: 32px;
}

@media (min-width: 900px) {
  .guide {
    grid-template-columns: 15rem minmax(0, 1fr);
    gap: 56px;
    align-items: start;
  }

  .contents {
    position: sticky;
    top: 24px;
  }
}

.contents {
  padding: 16px;
  background-color: var(--pane);
  border-top: 2px solid var(--ink);
}

.contents h2 {
  margin-bottom: 10px;
  font-family: var(--font-body);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.contents ol {
  margin: 0;
  padding: 0;
  max-width: none;
  list-style: none;
}

.contents li + li {
  margin-top: 0;
}

.contents a {
  display: block;
  padding: 8px 0;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
}

.contents a:hover {
  color: var(--moss);
}

.article h2 {
  margin-top: 56px;
  padding-top: 24px;
  border-top: 2px solid var(--ink);
  scroll-margin-top: 24px;
}

.article > h2:first-child {
  margin-top: 0;
}

.diagram {
  max-width: 40rem;
  margin: 24px 0 28px;
  padding: 20px;
  background-color: var(--pane);
  border: 1px solid var(--rule);
}

.diagram-svg {
  display: block;
  width: 100%;
  height: auto;
}

.diagram figcaption {
  margin-top: 12px;
  font-size: 0.92rem;
  color: var(--muted);
}

.dg-platform {
  fill: var(--rule);
}

.dg-bowl {
  fill: var(--paper);
  stroke: var(--ink);
  stroke-width: 3;
  stroke-linejoin: round;
}

.dg-contents {
  fill: var(--moss);
}

.dg-leader {
  fill: none;
  stroke: var(--ink);
  stroke-width: 2;
}

.dg-label {
  font-family: var(--font-body);
  font-size: 17px;
  font-weight: 700;
  fill: var(--ink);
}

/* Contact */

.address {
  font-family: var(--font-head);
  font-size: clamp(1.4rem, 1.1rem + 1.6vw, 2.4rem);
  font-weight: 700;
  overflow-wrap: anywhere;
}

.address a {
  color: var(--moss);
}

/* Footer */

.site-footer {
  background-color: var(--pane);
  border-top: 3px solid var(--ink);
  padding-block: 36px;
}

.footer-grid {
  display: grid;
  gap: 24px;
}

@media (min-width: 760px) {
  .footer-grid {
    grid-template-columns: 2fr 1fr 1fr;
  }
}

.site-footer p {
  margin-bottom: 0.6em;
  font-size: 0.92rem;
  color: var(--muted);
}

.site-footer .brand-name {
  display: block;
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 1.3rem;
}

.footer-label {
  margin: 0 0 8px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.footer-nav ul {
  margin: 0;
  padding: 0;
  list-style: none;
  max-width: none;
}

.footer-nav li + li {
  margin-top: 4px;
}

.site-footer a {
  color: var(--moss);
  overflow-wrap: anywhere;
}

/* Progressive enhancement switches */

.no-js .js-only {
  display: none !important;
}

.js .no-js-only {
  display: none !important;
}

/* Motion: every transition and animation has a static version */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  a,
  .index-list a,
  .site-nav a {
    transition: none;
  }

  .note {
    animation: none;
  }
}
