/* ampoule: the assembly sheet. One part, two steps. */

@font-face {
  font-family: "Familjen Grotesk";
  src: url("fonts/familjen-grotesk-latin.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("fonts/jetbrains-mono-latin.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}

:root {
  --paper: #ffffff;
  --ink: #17181a;
  --ink-soft: #4b4c4f;
  /* WebAssembly's blue and Elixir's purple: the two worlds ampoule joins. */
  --wasm: #654ff0;
  --elixir: #4e2a8e;
  --wash: #efeafa;

  --sans: "Familjen Grotesk", "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --gutter: clamp(1rem, 4vw, 3rem);
  --line: 3px;
  --hair: 1.5px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);

  color-scheme: light;
  accent-color: var(--ink);
  scrollbar-color: var(--ink) var(--paper);
}

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

html { scroll-behavior: smooth; scroll-padding-top: 1rem; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.55;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--wasm); color: var(--paper); }

a {
  color: inherit;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 0.2em;
  text-decoration-color: var(--elixir);
}

a:hover { text-decoration-thickness: 3px; text-decoration-color: var(--wasm); }

:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
  box-shadow: 0 0 0 7px var(--wasm);
  border-radius: 2px;
}

code, pre { font-family: var(--mono); font-size: 0.86em; }

:not(pre) > code {
  background: var(--wash);
  padding: 0.05em 0.3em;
  border-radius: 3px;
  overflow-wrap: anywhere;
}

h1, h2, h3, h4 { margin: 0; text-wrap: balance; }
p, ul, ol { margin: 0; }

.defs { position: absolute; width: 0; height: 0; overflow: hidden; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip {
  position: absolute;
  left: var(--gutter);
  top: -4rem;
  z-index: 10;
  background: var(--ink);
  color: var(--paper);
  padding: 0.6rem 1rem;
  font-weight: 650;
}

.skip:focus { top: 1rem; }

/* Masthead: the part-number strip at the top of the sheet. */

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 2rem;
  flex-wrap: wrap;
  padding: 1.1rem var(--gutter);
  border-bottom: var(--line) solid var(--ink);
}

.masthead-id { display: inline-flex; align-items: center; gap: 0.8rem; text-decoration: none; }

.mark { width: 2.5rem; height: 2.5rem; flex: none; }

.part-no { font-family: var(--mono); font-size: 0.82rem; font-weight: 700; letter-spacing: 0.04em; }

.masthead-nav { display: flex; flex-wrap: wrap; gap: 0.4rem 1.6rem; font-weight: 600; font-size: 0.95rem; }

.masthead-nav a {
  text-decoration: none;
  padding-block: 0.25rem;
  border-bottom: var(--line) solid transparent;
}

.masthead-nav a:hover { border-bottom-color: var(--wasm); }

/* Sheet one: the name and the one part on the left, the two steps on the right. */

.sheet-one {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.35fr);
  border-bottom: var(--line) solid var(--ink);
}

.cover {
  padding: clamp(2rem, 4vw, 3.5rem) var(--gutter);
  border-right: var(--line) solid var(--ink);
  background: var(--elixir);
  color: var(--paper);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.name {
  font-size: clamp(4rem, 9vw, 6rem);
  font-weight: 700;
  line-height: 0.85;
  letter-spacing: -0.035em;
}

.claim {
  font-size: clamp(1.35rem, 2.2vw, 1.75rem);
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: -0.01em;
  max-width: 22ch;
}

.inventory { padding-top: 0.5rem; }

.cover-foot { margin-top: auto; font-size: 0.9rem; font-weight: 600; color: var(--wash); }

/* The one part: the file you ship, drawn as the single item in the inventory. */
.the-part {
  display: grid;
  grid-template-columns: 4rem 1fr auto;
  align-items: center;
  gap: 1rem;
  padding: 1.1rem 1.25rem 1.1rem 1rem;
  border: var(--line) solid var(--wasm);
  border-radius: 6px;
  background: var(--wash);
  color: var(--ink);
}

.js .the-part { animation: arrive 0.8s 0.3s var(--ease) backwards; }

@keyframes arrive {
  from { box-shadow: 0 0 0 12px var(--wasm); }
  to { box-shadow: 0 0 0 0 var(--wasm); }
}

.the-part .mark { width: 4rem; height: 4rem; }

.the-part .part-name {
  display: block;
  font-family: var(--mono);
  font-size: 1rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.qty { font-family: var(--mono); font-weight: 700; font-size: 1.05rem; background: var(--wasm); color: var(--paper); padding: 0.3rem 0.55rem; border-radius: 4px; }

.part-desc { display: block; font-size: 0.95rem; line-height: 1.4; margin-top: 0.25rem; }

/* The steps. */

.steps { list-style: none; padding: 0; margin: 0; display: grid; }

.step {
  display: grid;
  grid-template-columns: clamp(9rem, 14vw, 12rem) minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  column-gap: clamp(1rem, 2.5vw, 2rem);
  padding: clamp(1.75rem, 3vw, 2.5rem) var(--gutter);
}

.step + .step { border-top: var(--line) solid var(--ink); }

.step-no {
  display: grid;
  place-items: center;
  width: clamp(5.5rem, 8vw, 8rem);
  height: clamp(5.5rem, 8vw, 8rem);
  border: 6px solid var(--ink);
  border-radius: 50%;
  font-size: clamp(3.5rem, 5.4vw, 5.25rem);
  font-weight: 700;
  line-height: 1;
  /* A single digit takes no letter-spacing (it would narrow the box and push the digit right), and this
     nudge puts its ink on the circle's centre: measured on renders, not by eye. */
  padding-bottom: 0.13em;
  transition: background-color 0.4s var(--ease), color 0.4s var(--ease);
}

.step.is-done .step-no { background: var(--wasm); border-color: var(--wasm); color: var(--paper); }

.picto {
  grid-column: 1;
  grid-row: 2;
  width: 100%;
  max-width: 11rem;
  margin-top: 1.25rem;
  overflow: visible;
}

.picto .ink-fill { fill: var(--ink); }
.picto .accent-fill { fill: var(--wasm); }

.picto .body,
.picto .limb,
.picto .line,
.picto .accent-stroke { fill: none; stroke-linecap: round; stroke-linejoin: round; }

.picto .body { stroke: var(--ink); stroke-width: 18; }
.picto .limb { stroke: var(--ink); stroke-width: 10; }
.picto .line { stroke: var(--ink); stroke-width: 4; }
.picto .heavy { stroke-width: 7; }
.picto .box { fill: var(--paper); }
.picto .dash { stroke-dasharray: 2 9; }
.picto .accent-stroke { stroke: var(--elixir); stroke-width: 4; }

.step-body {
  grid-column: 2;
  grid-row: 1 / span 2;
  display: grid;
  align-content: start;
  gap: 0.9rem;
  min-width: 0;
}

.step-title {
  font-size: clamp(1.45rem, 2.4vw, 1.9rem);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.02em;
  margin-top: 0.6rem;
}


/* A command plate: an ink rule, a paper ground, the copy control docked on its edge. */
.plate {
  display: flex;
  align-items: stretch;
  border: var(--hair) solid var(--ink);
  border-radius: 6px;
  overflow: hidden;
}

.cmd {
  margin: 0;
  padding: 0.85rem 1rem;
  font-size: 0.9rem;
  line-height: 1.65;
  /* Commands and output are shown as a terminal prints them: `==>` stays three characters. */
  font-variant-ligatures: none;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  overflow-x: auto;
}

.plate .cmd { flex: 1; min-width: 0; }
/* The plate sets the size; code inside it does not shrink again. */
.cmd code { font-size: inherit; }
.step .cmd { font-size: 0.9rem; }

.cmd .p { color: var(--elixir); font-weight: 700; user-select: none; }
.cmd .o { color: var(--ink-soft); }
.cmd .token { white-space: nowrap; font-weight: 700; }
.cmd .keep { white-space: nowrap; }

.copy {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0 1rem;
  border: 0;
  border-left: var(--hair) solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  font: 650 0.9rem/1 var(--sans);
  cursor: pointer;
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease);
}

.copy svg { width: 1.1rem; height: 1.1rem; }
.copy:hover { background: var(--wasm); color: var(--paper); }
.copy:active { transform: translateY(1px); }
.copy:focus-visible { outline-offset: -5px; outline-color: var(--paper); box-shadow: none; }

.note, .needs { font-size: 0.9rem; color: var(--ink-soft); }

/* A command and the sentence that says where to run it, kept together. */
.stage { display: grid; gap: 0.4rem; min-width: 0; }
.stage-say { font-weight: 600; }

.done { display: flex; align-items: center; gap: 0.6rem; font-size: 1.15rem; font-weight: 700; }
.done svg { width: 2.25rem; height: 2.25rem; flex: none; }

/* Proof: the real output, laid on the sheet. */

.proof { padding: clamp(2.5rem, 5vw, 4rem) var(--gutter); border-bottom: var(--line) solid var(--ink); }

.specimen { margin: 0; max-width: 62rem; display: grid; gap: 1rem; }

.specimen .cmd {
  border: var(--line) solid var(--ink);
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  font-size: 0.85rem;
  white-space: pre;
  overflow-wrap: normal;
}

.specimen figcaption { max-width: 68ch; color: var(--ink-soft); font-size: 0.95rem; }

/* Later sheets. */

.more, .rules, .exploded, .specs {
  padding: clamp(3rem, 6vw, 5rem) var(--gutter);
  border-bottom: var(--line) solid var(--ink);
}

.sheet-title {
  font-size: clamp(1.9rem, 4vw, 2.75rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin-bottom: clamp(1.75rem, 3vw, 2.5rem);
}

/* When you need more: optional fittings in three groups, each a row of text and its command. */
.more .sheet-title { margin-bottom: 0.75rem; }
.more-lede { font-size: clamp(1.1rem, 1.6vw, 1.3rem); color: var(--ink-soft); max-width: 62ch; margin-bottom: clamp(2rem, 4vw, 3rem); }

.fit-group {
  display: grid;
  grid-template-columns: minmax(10rem, 15rem) minmax(0, 1fr);
  gap: 0 clamp(1.5rem, 4vw, 3.5rem);
  border-top: var(--line) solid var(--ink);
}
.fit-group + .fit-group { margin-top: clamp(1.5rem, 3vw, 2.5rem); }
.fit-group > h3 {
  font-size: clamp(1.45rem, 2.4vw, 1.9rem);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.02em;
  padding-top: 1.5rem;
  align-self: start;
  position: sticky;
  top: 1rem;
}

.fit {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 1rem clamp(1.5rem, 3vw, 2.5rem);
  padding-block: 1.5rem;
}
.fit + .fit { border-top: var(--hair) solid var(--ink); }
.fit-text, .fit-code { display: grid; gap: 0.75rem; align-content: start; min-width: 0; }
.fit h4 { font-size: 1.3rem; font-weight: 700; line-height: 1.2; }
.fit p { max-width: 62ch; }
.fit .cmd { border: var(--hair) solid var(--ink); border-radius: 6px; }

.back-cmd .step-no { width: 4.75rem; height: 4.75rem; border-width: 4px; font-size: 3rem; }

.rules-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border: var(--line) solid var(--ink);
  border-radius: 8px;
  overflow: hidden;
}

.rule-col { padding: clamp(1.25rem, 3vw, 2rem); }
.rule-col + .rule-col { border-left: var(--line) solid var(--ink); }
.rule-col:first-child { background: var(--wash); }

.rule-col h3 {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.rule-icon { width: 2.5rem; height: 2.5rem; flex: none; }

.rule-col ul, .aside-list { padding-left: 1.2rem; display: grid; gap: 0.65rem; }
.rule-col li::marker, .aside-list li::marker { color: var(--elixir); }

.aside-title { font-size: 1.15rem; font-weight: 700; margin: 2.25rem 0 0.85rem; }
.aside-list { max-width: 75ch; color: var(--ink-soft); }

/* Exploded view of the file: an ink drawing, sections pulled apart, callouts on dashed leaders. */

.drawing { margin: 0; }

.draw-wide { display: block; width: 100%; height: auto; overflow: visible; }

.draw-tall { display: none; }

.draw-wide .sec { fill: var(--paper); stroke: var(--ink); stroke-width: 4; }
.draw-wide .fill-wasm { fill: var(--wasm); }
.draw-wide .dashed { stroke-dasharray: 10 7; }
.draw-wide .hair { stroke: var(--ink); stroke-width: 1.5; stroke-linecap: round; fill: none; }
.draw-wide .hair-light { stroke: var(--paper); stroke-width: 1.5; opacity: 0.45; fill: none; }
.draw-wide .ghost { stroke: var(--ink); stroke-width: 1.5; stroke-dasharray: 2 8; stroke-linecap: round; fill: none; }
.draw-wide .leader { stroke: var(--ink); stroke-width: 1.5; stroke-dasharray: 4 5; fill: none; }
.draw-wide .callouts circle { fill: var(--paper); stroke: var(--ink); stroke-width: 2.5; }
.draw-wide .callouts text { font: 700 15px var(--sans); text-anchor: middle; fill: var(--ink); }

.file {
  list-style: none;
  padding: 0;
  margin: 1.5rem 0 0;
  display: grid;
  /* The same proportions as the drawing's sections, so each entry sits under its callout. */
  grid-template-columns: 200fr 280fr 180fr 140fr 120fr;
  column-gap: 2%;
}

.file li { display: grid; grid-template-columns: 2rem minmax(0, 1fr); gap: 0.2rem 0.75rem; align-content: start; min-width: 0; }

/* On the wide drawing the callouts are in the drawing itself; the legend only names them. */
.file .callout { display: none; }
.file li { grid-template-columns: minmax(0, 1fr); }

.callout {
  grid-row: 1 / span 2;
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border: 2.5px solid var(--ink);
  border-radius: 50%;
  font-weight: 700;
  font-size: 1rem;
}

.seg-name { font-weight: 700; line-height: 1.2; padding-top: 0.3rem; }
.seg-desc { font-size: 0.92rem; color: var(--ink-soft); line-height: 1.45; }

/* Specifications. */

.specs table { width: 100%; max-width: 62rem; border-collapse: collapse; }

.specs th, .specs td {
  padding: 0.85rem 0;
  border-bottom: var(--hair) solid var(--ink);
  vertical-align: baseline;
}

.specs tr:first-child th, .specs tr:first-child td { border-top: var(--line) solid var(--ink); }

.specs th { text-align: left; font-weight: 500; padding-right: 2rem; }

.specs td { text-align: right; font-size: 1.35rem; font-weight: 700; white-space: nowrap; }
.specs td.text { font-size: 1rem; font-weight: 600; white-space: normal; }
.specs .aside { display: block; font-size: 0.85rem; font-weight: 500; color: var(--ink-soft); }

/* Test report: the bench rig, a scaling chart drawn like the rest of the sheet, then the
   measurements in the specification table's form. The measured line is the one blue mark. */

.rig { max-width: 62ch; margin-bottom: 1.5rem; color: var(--ink-soft); font-weight: 500; }

.scaling { max-width: 46rem; margin: 0 0 clamp(2rem, 4vw, 3rem); }
.scaling svg { display: block; width: 100%; height: auto; overflow: visible; }
.scaling figcaption { max-width: 62ch; margin-top: 0.75rem; font-size: 0.92rem; color: var(--ink-soft); }

.scaling .grid path { fill: none; stroke: #e4e4e6; stroke-width: 1; }
.scaling .axis path { fill: none; stroke: var(--ink); stroke-width: var(--hair); }
.scaling text { font: 600 13px var(--sans); fill: var(--ink-soft); text-anchor: middle; font-variant-numeric: tabular-nums; }
.scaling text.y { text-anchor: end; }
.scaling text.title { font-weight: 500; }
.scaling text.end { text-anchor: end; }
.scaling .cores { fill: none; stroke: var(--ink); stroke-width: 1; stroke-dasharray: 2 4; }
.scaling .cores-label { text-anchor: start; font-weight: 500; }
.scaling .cores-label.end { text-anchor: end; }
.scaling .ideal { fill: none; stroke: var(--ink); stroke-width: var(--hair); stroke-dasharray: 6 6; stroke-linecap: round; }
.scaling .ideal-label { text-anchor: end; font-weight: 500; }
.scaling .measured { fill: none; stroke: var(--wasm); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.scaling .points circle { fill: var(--wasm); stroke: var(--paper); stroke-width: 2; }
.scaling .points circle:hover { r: 7; }
.scaling .end-label { font: 700 22px var(--sans); fill: var(--ink); }

/* Back cover. */

.back { padding: clamp(3rem, 6vw, 5rem) var(--gutter) 2rem; display: grid; gap: 3rem; }

.back-cmd {
  display: grid;
  grid-template-columns: auto minmax(0, 32rem);
  justify-content: start;
  align-items: center;
  gap: 1rem 1.5rem;
}

.back-cmd .plate { border-width: var(--line); }
.back-cmd .cmd { font-size: 1.15rem; padding: 1rem 1.25rem; }
.back-install { grid-column: 2; font-weight: 600; }

.back-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.5rem;
  padding-top: 1.5rem;
  border-top: var(--line) solid var(--ink);
  font-weight: 600;
}

.back-links .mark { width: 2rem; height: 2rem; }
.back-links .part-no { margin-right: auto; }

/* Narrow sheets. */

@media (max-width: 1020px) {
  .sheet-one { grid-template-columns: 1fr; }
  .cover { border-right: 0; border-bottom: var(--line) solid var(--ink); }
  .fit-group { grid-template-columns: 1fr; }
  .fit-group > h3 { position: static; padding-top: 1.25rem; }
  .file { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 1.5rem; row-gap: 1.25rem; }
  .draw-wide:not(.draw-tall) { display: none; }
  .draw-tall { display: block; width: 12rem; }
  .file .callout { display: grid; }
  .file li { grid-template-columns: 2rem minmax(0, 1fr); }
}

@media (max-width: 640px) {
  .masthead { flex-wrap: nowrap; }
  .masthead .part-no { display: none; }
  .masthead-nav { gap: 0.3rem 1rem; font-size: 0.9rem; }
  .the-part { grid-template-columns: 3rem minmax(0, 1fr); }
  .the-part .mark { width: 3rem; height: 3rem; }
  .the-part .qty { grid-column: 2; justify-self: start; }


  .step { grid-template-columns: auto minmax(0, 9rem); grid-template-rows: auto auto; justify-content: start; align-items: end; gap: 0 1.25rem; }
  .step .step-no { width: 5rem; height: 5rem; border-width: 5px; font-size: 3.2rem; }
  .picto { grid-column: 2; grid-row: 1; margin-top: 0; }
  .step-body { grid-column: 1 / -1; grid-row: 2; }

  .fit { grid-template-columns: 1fr; }

  .rules-grid { grid-template-columns: 1fr; }
  .rule-col + .rule-col { border-left: 0; border-top: var(--line) solid var(--ink); }

  .specs th, .specs td { display: block; text-align: left; padding: 0; border: 0; }
  .specs tr { display: block; padding: 0.75rem 0; border-bottom: var(--hair) solid var(--ink); }
  .specs tr:first-child { border-top: var(--line) solid var(--ink); }
  .specs tr:first-child th, .specs tr:first-child td { border-top: 0; }
  .specs td { white-space: normal; }

  .back-cmd { grid-template-columns: 1fr; }
  .back-install { grid-column: 1; }

  .specimen .cmd { padding: 1rem; font-size: 0.8rem; white-space: pre-wrap; overflow-wrap: anywhere; }
  .cmd, .step .cmd { font-size: 0.8rem; }
  /* The copy control docks under the command, so the command gets the full width. */
  .plate { flex-direction: column; }
  .copy { justify-content: center; padding: 0.7rem 1rem; border-left: 0; border-top: var(--hair) solid var(--ink); }

  /* The chart scales as a whole; its labels grow in chart units so they still print at about 12px. */
  .scaling text { font-size: 28px; }
  .scaling .cores-label, .scaling .ideal-label { font-size: 24px; }
  .scaling .end-label { font-size: 40px; }
  .scaling .long { display: none; }
  .file { grid-template-columns: 1fr; }
}

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

  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
