/* M3D Parts - shared stylesheet
   One file, no build step. Loaded by every page. */

/* ---------- tokens ---------- */

:root {
  --ground: #fbfbfa;
  --panel: #ffffff;
  --ink: #16191a;
  --ink-2: #4d5457;
  --ink-3: #6f7679;
  --rule: #dcdfdf;
  --rule-strong: #b6bcbc;
  --accent: #0f5460;
  --accent-deep: #0a3b44;
  --accent-wash: #eef3f4;
  --alert: #8f2c1c;

  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  /* mono is reserved for real alphanumeric identifiers: model numbers,
     part numbers. Not for decorative labels. */
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;

  --measure: 62ch;
  --gutter: 1.25rem;
}

/* ---------- reset ---------- */

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

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

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ---------- type scale ---------- */

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.15;
  letter-spacing: -0.02em;
  font-weight: 650;
  text-wrap: balance;
}

h1 {
  font-size: clamp(1.9rem, 1.4rem + 2.4vw, 2.9rem);
}

h2 {
  font-size: clamp(1.35rem, 1.15rem + 1vw, 1.7rem);
}

h3 {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

p,
ul,
ol,
dl {
  margin: 0 0 1rem;
}

p,
li {
  max-width: var(--measure);
}

.lede {
  font-size: 1.125rem;
  color: var(--ink-2);
  margin-top: 0.85rem;
}

.note {
  font-size: 0.875rem;
  color: var(--ink-2);
  line-height: 1.55;
}

code,
.ident {
  font-family: var(--mono);
  font-size: 0.92em;
}

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

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

:where(a, button, input, select, textarea, summary):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 1px;
}

/* ---------- layout ---------- */

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

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--ink);
  color: var(--ground);
  padding: 0.6rem 0.9rem;
  z-index: 10;
}

.skip:focus {
  left: 0.5rem;
  top: 0.5rem;
}

/* ---------- header ---------- */

.masthead {
  border-bottom: 1px solid var(--rule);
  background: var(--panel);
}

.masthead .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 1.5rem;
  padding-top: 0.9rem;
  padding-bottom: 0.9rem;
}

.wordmark {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
}

.wordmark span {
  display: block;
  font-size: 0.78rem;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--ink-3);
  margin-top: 0.1rem;
}

.nav {
  margin-left: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.15rem;
  font-size: 0.9rem;
}

.nav a {
  color: var(--ink-2);
  text-decoration: none;
  padding: 0.15rem 0;
  border-bottom: 2px solid transparent;
}

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

.nav a[aria-current="page"] {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

/* ---------- page head ---------- */

.pagehead {
  padding: 2.5rem 0 1.75rem;
  border-bottom: 1px solid var(--rule);
}

/* ---------- two column ---------- */

.cols {
  display: grid;
  gap: 2.5rem;
  padding: 2rem 0 3rem;
  align-items: start;
}

/* Grid items default to min-width:auto, so a wide child (a spec table) would
   stretch the column past the viewport and scroll the whole page sideways.
   The desktop rule below already handles this with minmax(0, ...). */
.cols > * {
  min-width: 0;
}

@media (min-width: 56rem) {
  .cols {
    grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
    gap: 3.5rem;
  }

  .cols > aside {
    position: sticky;
    top: 1.5rem;
  }
}

/* ---------- spec list, the label/value pattern ---------- */

.spec {
  margin: 0;
  border-top: 1px solid var(--rule);
}

.spec > div {
  display: grid;
  gap: 0.1rem 1rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--rule);
}

@media (min-width: 30rem) {
  .spec > div {
    grid-template-columns: 9.5rem minmax(0, 1fr);
  }
}

.spec dt {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--ink);
}

.spec dd {
  margin: 0;
  color: var(--ink-2);
  font-size: 0.9rem;
}

/* A note set off below the block it comments on. */
.note-after {
  margin-top: 1.25rem;
}

/* ---------- matrix, the spec-sheet table ---------- */

/* Wide tables scroll inside themselves rather than pushing the page sideways. */
.matrix-scroll {
  overflow-x: auto;
  margin: 1.25rem 0 0;
  border-top: 1px solid var(--rule-strong);
}

.matrix {
  width: 100%;
  min-width: 26rem;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.matrix th,
.matrix td {
  text-align: left;
  vertical-align: top;
  padding: 0.65rem 1rem 0.65rem 0;
  border-bottom: 1px solid var(--rule);
}

.matrix th {
  font-weight: 600;
  color: var(--ink);
}

/* Dimensions and model numbers break badly. Keep each on one line and let the
   surrounding prose cells absorb the wrapping instead. */
.matrix .ident {
  white-space: nowrap;
}

.matrix thead th {
  white-space: nowrap;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-3);
  border-bottom: 1px solid var(--rule-strong);
}

.matrix td {
  color: var(--ink-2);
}

.matrix tbody th {
  padding-right: 1.5rem;
}

/* ---------- run of labelled sections ---------- */

.sect {
  padding: 2rem 0 0;
}

.sect:first-child {
  padding-top: 0;
}

.sect > p,
.sect > ul {
  max-width: var(--measure);
}

/* Subheads inside a section need air above them, especially where they follow
   a table that ends on a rule. */
.sect h3 {
  margin-top: 1.9rem;
  margin-bottom: 0.35rem;
}

.sect ul {
  padding-left: 1.1rem;
}

.sect li {
  margin-bottom: 0.5rem;
  color: var(--ink-2);
}

/* A caveat that belongs with the data above it, not a disclaimer wall. */
.caveat {
  margin: 1rem 0 0;
  padding-left: 0.9rem;
  border-left: 2px solid var(--rule-strong);
  color: var(--ink-2);
  font-size: 0.92rem;
  max-width: var(--measure);
}

/* ---------- form ---------- */

.form {
  margin: 0;
}

fieldset {
  border: 0;
  border-top: 1px solid var(--rule-strong);
  margin: 0 0 1.75rem;
  padding: 1.1rem 0 0;
  min-width: 0;
}

legend {
  padding: 0;
  font-weight: 650;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}

.fields {
  display: grid;
  gap: 1.1rem;
  margin-top: 1rem;
}

@media (min-width: 34rem) {
  .fields.two {
    grid-template-columns: 1fr 1fr;
  }

  .field.full {
    grid-column: 1 / -1;
  }
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 0;
}

.field label {
  font-size: 0.9rem;
  font-weight: 600;
}

.field label .opt {
  font-weight: 400;
  color: var(--ink-3);
}

.field .hint {
  font-size: 0.82rem;
  color: var(--ink-3);
  line-height: 1.45;
}

input,
select,
textarea {
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--rule-strong);
  border-radius: 2px;
  padding: 0.55rem 0.65rem;
  width: 100%;
  min-width: 0;
}

textarea {
  resize: vertical;
  min-height: 6.5rem;
  line-height: 1.5;
}

input:hover,
select:hover,
textarea:hover {
  border-color: var(--ink-3);
}

input[name="equipment"],
input[name="quantity"] {
  font-family: var(--mono);
  font-size: 0.95rem;
}

select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%),
    linear-gradient(135deg, var(--ink-2) 50%, transparent 50%);
  background-position: calc(100% - 1.05rem) 1.15rem,
    calc(100% - 0.7rem) 1.15rem;
  background-size: 0.35rem 0.35rem;
  background-repeat: no-repeat;
  padding-right: 2rem;
}

.field[data-invalid="true"] input,
.field[data-invalid="true"] select,
.field[data-invalid="true"] textarea {
  border-color: var(--alert);
  border-width: 2px;
}

.field .err {
  font-size: 0.82rem;
  color: var(--alert);
  font-weight: 600;
}

/* ---------- acceptance checkbox ---------- */

/* Reuses .field so the shared clearErrors and markError helpers in request.html
   find it exactly like any other field. Only the axis changes. */
.check {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.7rem;
  padding: 0.35rem 0 0;
}

.check input[type="checkbox"] {
  flex: none;
  width: 1.15rem;
  height: 1.15rem;
  min-width: 1.15rem;
  margin: 0;
  padding: 0;
  /* Native control, tinted to the palette. No custom checkbox to keep
     accessible. */
  accent-color: var(--accent);
}

/* The label takes the remaining width so its second line wraps under itself
   rather than tucking under the checkbox. */
.check label {
  flex: 1 1 0;
  min-width: 0;
  font-weight: 400;
  font-size: 0.9rem;
  line-height: 1.5;
  /* Comfortably past a 44px touch target, and the whole label is clickable
     through the for attribute. */
  padding: 0.15rem 0 0.55rem;
  color: var(--ink-2);
}

/* Not signalled by color alone. */
.check label a {
  font-weight: 600;
  text-decoration: underline;
}

/* The error message sits on its own line under both control and label. */
.check .err {
  flex-basis: 100%;
}

/* A native checkbox ignores border, so the invalid state is drawn as an
   outline instead. Same token and weight as the bordered fields above. */
.check[data-invalid="true"] input[type="checkbox"] {
  outline: 2px solid var(--alert);
  outline-offset: 2px;
}

/* honeypot. Off screen rather than display:none so naive bots still fill it. */
.trap {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ---------- buttons ---------- */

.btn {
  display: inline-block;
  font: inherit;
  font-weight: 650;
  font-size: 1rem;
  line-height: 1.2;
  color: #fff;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 2px;
  padding: 0.7rem 1.4rem;
  cursor: pointer;
  text-decoration: none;
}

.btn:hover {
  background: var(--accent-deep);
  border-color: var(--accent-deep);
  color: #fff;
}

.btn[disabled] {
  background: var(--ink-3);
  border-color: var(--ink-3);
  cursor: progress;
}

.submit-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  margin-top: 1.5rem;
}

/* ---------- status messages ---------- */

.status:not(:empty) {
  margin-top: 1.25rem;
  padding: 0.9rem 1rem;
  border-left: 3px solid var(--accent);
  background: var(--accent-wash);
  font-size: 0.95rem;
}

.status:not(:empty) p {
  margin: 0 0 0.4rem;
}

.status:not(:empty) p:last-child {
  margin-bottom: 0;
}

.status[data-state="error"]:not(:empty) {
  border-left-color: var(--alert);
  background: #f8efed;
}

/* ---------- scope note ---------- */

.scope {
  border-left: 3px solid var(--rule-strong);
  padding: 0.15rem 0 0.15rem 0.9rem;
  margin: 1.5rem 0;
  font-size: 0.875rem;
  color: var(--ink-2);
  line-height: 1.55;
}

.scope p {
  margin: 0 0 0.5rem;
  max-width: var(--measure);
}

.scope p:last-child {
  margin-bottom: 0;
}

/* ---------- aside panel ---------- */

.panel {
  background: var(--panel);
  border: 1px solid var(--rule);
  padding: 1.25rem;
}

.panel h2 {
  font-size: 1.15rem;
}

.panel ul {
  padding-left: 1.1rem;
  margin: 0.9rem 0 0;
}

.panel li {
  margin-bottom: 0.65rem;
  font-size: 0.92rem;
  color: var(--ink-2);
  line-height: 1.5;
}

.panel li:last-child {
  margin-bottom: 0;
}

.panel li strong {
  color: var(--ink);
  font-weight: 600;
}

/* ---------- legal pages ---------- */

.legal {
  padding: 2rem 0 3rem;
}

.legal .sect > p,
.legal .sect > ol {
  max-width: var(--measure);
}

.legal h2 {
  font-size: 1.05rem;
}

.legal p {
  color: var(--ink-2);
}

.legal .alpha {
  list-style: lower-alpha;
  padding-left: 1.4rem;
  max-width: var(--measure);
}

.legal .alpha li {
  margin-bottom: 0.65rem;
  color: var(--ink-2);
}

/* Draft warning. Uses the existing alert token, no new color. */
.notice {
  border: 1px solid var(--alert);
  border-left-width: 3px;
  background: var(--panel);
  padding: 0.9rem 1.1rem;
  margin-bottom: 2rem;
  max-width: var(--measure);
}

.notice p {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--ink-2);
}

.notice strong {
  color: var(--alert);
}

/* ---------- footer ---------- */

.foot {
  border-top: 1px solid var(--rule);
  background: var(--panel);
  padding: 2rem 0 2.5rem;
  font-size: 0.875rem;
  color: var(--ink-2);
}

.foot-grid {
  display: grid;
  gap: 1.5rem;
}

@media (min-width: 44rem) {
  .foot-grid {
    grid-template-columns: 1fr 1.4fr;
    gap: 3rem;
  }
}

.foot h2 {
  font-size: 0.95rem;
  font-weight: 650;
  margin-bottom: 0.4rem;
}

.foot p {
  margin: 0 0 0.4rem;
  line-height: 1.55;
}

.foot-links {
  margin: 0 0 0.4rem;
}

.foot-links a + a {
  margin-left: 1rem;
}

.foot .fine {
  color: var(--ink-3);
  font-size: 0.82rem;
  margin-top: 1.5rem;
}

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

/* ---------- home page ---------- */

.hero {
  padding: 3rem 0 2.25rem;
  border-bottom: 1px solid var(--rule);
}

.hero h1 {
  max-width: 18ch;
  font-size: clamp(2.1rem, 1.3rem + 3.4vw, 3.4rem);
}

.hero .lede {
  max-width: 54ch;
  font-size: clamp(1.1rem, 1rem + 0.4vw, 1.25rem);
}

.hero .submit-row {
  margin-top: 1.75rem;
}

.hero .spec {
  margin-top: 2.25rem;
  max-width: 40rem;
}

section.block {
  padding: 2.5rem 0;
  border-bottom: 1px solid var(--rule);
}

section.block > .wrap > h2 {
  margin-bottom: 1.25rem;
}

/* dense multi-column list of part types */
.inventory {
  list-style: none;
  padding: 0;
  margin: 0;
  columns: 2;
  column-gap: 2rem;
  max-width: 46rem;
}

@media (min-width: 48rem) {
  .inventory {
    columns: 3;
  }
}

.inventory li {
  break-inside: avoid;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--rule);
  font-size: 0.92rem;
  color: var(--ink-2);
}

/* three numbered steps */
.steps {
  list-style: none;
  counter-reset: step;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 1.75rem;
}

@media (min-width: 50rem) {
  .steps {
    grid-template-columns: repeat(3, 1fr);
    gap: 2.5rem;
  }
}

.steps li {
  counter-increment: step;
  border-top: 2px solid var(--accent);
  padding-top: 0.9rem;
  max-width: none;
}

.steps li::before {
  content: counter(step);
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 0.35rem;
}

.steps h3 {
  margin-bottom: 0.4rem;
}

.steps p {
  font-size: 0.92rem;
  color: var(--ink-2);
  margin: 0;
  max-width: none;
}

/* audience blocks */
.who {
  display: grid;
  gap: 1.75rem;
}

@media (min-width: 50rem) {
  .who {
    grid-template-columns: repeat(3, 1fr);
    gap: 2.5rem;
  }
}

.who h3 {
  margin-bottom: 0.4rem;
}

.who p {
  font-size: 0.92rem;
  color: var(--ink-2);
  margin: 0;
  max-width: none;
}

/* closing call to action */
.band {
  padding: 3rem 0;
  background: var(--panel);
  border-bottom: 1px solid var(--rule);
}

.band h2 {
  max-width: 22ch;
}

.band p {
  margin-top: 0.75rem;
  color: var(--ink-2);
}
