/* spiler.dev: the component datasheet.
   A part is described completely enough that someone else could build with it:
   part number, general description, features, block diagram, specification
   tables, application notes, ordering information. That is the whole system.
   Self-hosted Archivo (body) and Archivo Narrow (labels, heads, part numbers).
   No monospace anywhere: real datasheets set their data in the same face with
   tabular figures, and mono here would be a costume for "technical". */

@font-face {
  font-family: 'Archivo';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/assets/fonts/archivo-var.woff2') format('woff2-variations');
}

@font-face {
  font-family: 'Archivo Narrow';
  font-style: normal;
  font-weight: 500 700;
  font-display: swap;
  src: url('/assets/fonts/archivo-narrow-var.woff2') format('woff2-variations');
}

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

/* The sheet. Light is not a default here: this is a printed document, read the
   way a spec is read, and a datasheet on black would be a screenshot of one. */
body {
  font-family: 'Archivo', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.65;
  color: #14181c;
  background-color: #ffffff;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}

::selection {
  background: #c8102e;
  color: #ffffff;
}

html {
  caret-color: #c8102e;
}

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---- running head: the part number, on every sheet ---- */

.doc-head {
  border-bottom: 2px solid #14181c;
}

.doc-head .container {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 24px;
  padding-top: 14px;
  padding-bottom: 10px;
}

.part-no {
  font-family: 'Archivo Narrow', 'Archivo', sans-serif;
  font-weight: 700;
  font-size: 1.0625rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #14181c;
  text-decoration: none;
  border: 0;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

.part-no:hover {
  color: #c8102e;
  background: none;
}

.doc-rev {
  font-family: 'Archivo Narrow', 'Archivo', sans-serif;
  font-weight: 600;
  font-size: 0.75rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #4a5560;
}

/* ---- contents strip ---- */

.toc {
  border-bottom: 1px solid #ccd3da;
}

.toc ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0 22px;
}

.toc a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-family: 'Archivo Narrow', 'Archivo', sans-serif;
  font-weight: 600;
  font-size: 0.8125rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #4a5560;
  text-decoration: none;
  border-bottom: 2px solid transparent;
}

/* The strip carries no numerals. A datasheet has one numbering system and the
   section heads own it; a second red 1-based counter 120px above them was the
   convention applied for its look rather than its logic. */
.toc a:hover {
  color: #14181c;
  background: none;
}

.toc a[aria-current='page'] {
  color: #c8102e;
  border-bottom-color: #c8102e;
}

.toc a[aria-current='page']:hover {
  color: #c8102e;
  background: none;
  border-bottom-color: #c8102e;
}

/* ---- title block ---- */

main {
  counter-reset: sect;
  padding-top: 40px;
  padding-bottom: 56px;
}

h1 {
  font-family: 'Archivo Narrow', 'Archivo', sans-serif;
  font-weight: 700;
  font-size: clamp(2.25rem, 6vw, 3.25rem);
  line-height: 1.05;
  letter-spacing: -0.005em;
  text-transform: uppercase;
  text-wrap: balance;
}

.lead {
  font-size: 1.1875rem;
  line-height: 1.5;
  color: #4a5560;
  max-width: none;
  margin-top: 12px;
  padding-bottom: 18px;
  border-bottom: 1px solid #ccd3da;
  text-wrap: pretty;
}

.lead span {
  display: block;
  max-width: 36rem;
}

/* ---- numbered section heads: the spine of the document ---- */

h2 {
  font-family: 'Archivo Narrow', 'Archivo', sans-serif;
  font-weight: 700;
  font-size: 0.9375rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #14181c;
  margin-top: 44px;
  margin-bottom: 16px;
  padding-bottom: 6px;
  border-bottom: 1px solid #14181c;
  display: flex;
  align-items: baseline;
  gap: 12px;
}

h2::before {
  content: counter(sect);
  counter-increment: sect;
  font-variant-numeric: tabular-nums;
  color: #c8102e;
  font-size: 0.9375rem;
}

h3 {
  font-family: 'Archivo Narrow', 'Archivo', sans-serif;
  font-weight: 700;
  font-size: 1.0625rem;
  letter-spacing: 0.01em;
  margin-top: 24px;
  margin-bottom: 6px;
}

p {
  max-width: 31rem;
  margin-bottom: 14px;
  text-wrap: pretty;
}

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

a {
  color: #c8102e;
  text-decoration: none;
  border-bottom: 1px solid #c8102e;
}

a:hover {
  color: #ffffff;
  background-color: #c8102e;
  border-bottom-color: #c8102e;
}

:focus-visible {
  outline: 2px solid #c8102e;
  outline-offset: 2px;
}

/* ---- features / applications: the terse bulleted blocks up front ---- */

.cols {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 40px;
}

ul.terse,
ol.terse {
  list-style: none;
  max-width: 40rem;
}

ul.terse li {
  position: relative;
  padding-left: 16px;
  margin-bottom: 6px;
}

ul.terse li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.72em;
  width: 6px;
  height: 1px;
  background: #c8102e;
}

/* ---- specification table: the evidence, in the form evidence takes here ---- */

.spec-wrap {
  overflow-x: auto;
}

table.spec {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
  line-height: 1.45;
}

table.spec caption {
  text-align: left;
  font-family: 'Archivo Narrow', 'Archivo', sans-serif;
  font-weight: 600;
  font-size: 0.75rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #4a5560;
  padding-bottom: 6px;
}

table.spec th,
table.spec td {
  text-align: left;
  vertical-align: baseline;
  padding: 9px 14px 9px 0;
  border-bottom: 1px solid #ccd3da;
}

table.spec thead th {
  background: #eef1f5;
  font-family: 'Archivo Narrow', 'Archivo', sans-serif;
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #14181c;
  padding: 8px 14px 8px 10px;
  border-bottom: 1px solid #14181c;
  white-space: nowrap;
}

table.spec tbody th {
  font-family: 'Archivo Narrow', 'Archivo', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  padding-left: 10px;
  white-space: nowrap;
}

table.spec td:first-of-type {
  padding-left: 10px;
}

table.spec tbody tr:hover {
  background: #f6f8fa;
}

table.spec .num {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: #4a5560;
}

/* Status is a mark, not a hue: the glyph carries it and colour only agrees. */
.mark {
  font-family: 'Archivo Narrow', 'Archivo', sans-serif;
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.mark::before {
  content: "\25CF\00a0";
  font-size: 1.35em;
  line-height: 1;
  color: #c8102e;
}

.mark.is-open::before {
  content: "\25CB\00a0";
  color: #5b6b7a;
}

.mark.is-half::before {
  content: "\25D0\00a0";
  color: #5b6b7a;
}

/* ---- block diagram ---- */

.diagram {
  margin: 4px 0 8px;
}

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

/* Both variants must outrank `.diagram svg` above, which sets display. */
.diagram svg.diagram-tall {
  display: none;
  max-width: 360px;
}

.diagram figcaption {
  font-family: 'Archivo Narrow', 'Archivo', sans-serif;
  font-weight: 600;
  font-size: 0.75rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #4a5560;
  margin-top: 8px;
}

/* ---- ordering information: how to reach the part's maker ---- */

.kv {
  list-style: none;
  max-width: none;
  border-top: 1px solid #ccd3da;
}

/* A section head already draws a rule; the list must not draw a second one
   16px below it. */
h2 + .kv,
h2 + .notes,
h2 + .detail,
h2 + .spec-wrap table.spec {
  border-top: 0;
}

.kv li {
  display: grid;
  grid-template-columns: 8.5rem 1fr;
  gap: 0 20px;
  align-items: baseline;
  border-bottom: 1px solid #ccd3da;
}

.kv .k {
  font-family: 'Archivo Narrow', 'Archivo', sans-serif;
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #4a5560;
  padding: 12px 0;
}

/* Inline-flex, not block: a block anchor stretches its red underline and its
   hover ground across the entire value column, so the row's grey hairline
   changed colour mid-span. The target height stays 44px either way.
   The rule is a text decoration rather than a border, because a border sits on
   the 44px box edge while the text is centred inside it, leaving the underline
   floating 13px below the words. */
.kv a,
.stamp a {
  border-bottom: 0;
  text-decoration: underline;
  text-decoration-color: currentColor;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.kv a {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  min-height: 44px;
  padding: 4px 0;
}

/* ---- application notes (the blog) ---- */

.notes {
  list-style: none;
  border-top: 1px solid #ccd3da;
}

.notes > li {
  display: grid;
  grid-template-columns: 8.5rem 1fr;
  gap: 0 20px;
  padding: 16px 0;
  border-bottom: 1px solid #ccd3da;
}

.notes .note-no {
  font-family: 'Archivo Narrow', 'Archivo', sans-serif;
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #4a5560;
  font-variant-numeric: tabular-nums;
}

.notes h3 {
  margin-top: 0;
  margin-bottom: 4px;
}

.notes p {
  margin-bottom: 0;
  color: #4a5560;
  font-size: 0.9375rem;
  max-width: 30rem;
}

/* Detailed description: the item name sits in the rail so a page of prose
   still occupies the sheet's full width, the way a spec section does. */
.detail {
  list-style: none;
  border-top: 1px solid #ccd3da;
}

.detail > li {
  display: grid;
  grid-template-columns: 10rem 1fr;
  gap: 0 24px;
  padding: 18px 0;
  border-bottom: 1px solid #ccd3da;
}

.detail .item {
  font-family: 'Archivo Narrow', 'Archivo', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.35;
}

.detail .item .num {
  display: block;
  font-size: 0.75rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #4a5560;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* Source line: where a principle comes from. Sentence case, because a reference
   is read as a sentence and the label voice is unreadable past a few words. */
.source {
  font-size: 0.8125rem;
  line-height: 1.5;
  color: #4a5560;
  max-width: 24rem;
}

.post-meta {
  font-family: 'Archivo Narrow', 'Archivo', sans-serif;
  font-weight: 600;
  font-size: 0.75rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #4a5560;
  max-width: none;
  margin-top: 10px;
  padding-bottom: 14px;
  border-bottom: 1px solid #ccd3da;
}

.post-nav {
  max-width: none;
  margin-top: 36px;
  padding-top: 14px;
  border-top: 1px solid #ccd3da;
  font-family: 'Archivo Narrow', 'Archivo', sans-serif;
  font-weight: 600;
  font-size: 0.8125rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.empty-state {
  border: 1px solid #14181c;
  padding: 18px 20px;
  background: #f6f8fa;
}

.empty-state h3 {
  margin-top: 0;
}

blockquote,
.callout {
  border-top: 1px solid #14181c;
  border-bottom: 1px solid #14181c;
  background: #f6f8fa;
  padding: 14px 18px;
  margin-bottom: 16px;
}

blockquote::before,
.callout::before {
  content: "Note";
  display: block;
  font-family: 'Archivo Narrow', 'Archivo', sans-serif;
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #4a5560;
  margin-bottom: 4px;
}

code {
  font-family: 'Archivo Narrow', 'Archivo', sans-serif;
  font-weight: 600;
  background: #eef1f5;
  padding: 1px 5px;
  font-size: 0.95em;
}

hr {
  border: 0;
  border-top: 1px solid #ccd3da;
  margin: 32px 0;
}

/* ---- sheet footer: the stamp every controlled document carries ---- */

.stamp {
  border-top: 2px solid #14181c;
  margin-top: 40px;
}

.stamp .container {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px 24px;
  padding-top: 12px;
  padding-bottom: 28px;
  font-family: 'Archivo Narrow', 'Archivo', sans-serif;
  font-weight: 600;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #4a5560;
}

.stamp p {
  max-width: none;
  margin-bottom: 0;
}

.stamp a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

.skip-link {
  position: absolute;
  left: -9999px;
}

.skip-link:focus {
  position: static;
  display: inline-block;
  background: #c8102e;
  color: #ffffff;
  padding: 10px 16px;
  font-family: 'Archivo Narrow', 'Archivo', sans-serif;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  border: 0;
}

@media (max-width: 760px) {
  .cols {
    grid-template-columns: 1fr;
    gap: 14px 0;
  }

  .kv li,
  .notes > li,
  .detail > li {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .detail .item {
    margin-bottom: 6px;
  }

  .kv .k {
    padding: 12px 0 0;
  }

  .kv a {
    padding: 2px 0 12px;
  }

  .toc ul {
    gap: 0 16px;
  }

  .spec-wrap {
    overflow-x: visible;
  }

  table.spec,
  table.spec tbody,
  table.spec tr,
  table.spec tbody th,
  table.spec td {
    display: block;
    width: auto;
  }

  table.spec {
    font-size: 0.9375rem;
  }

  /* With the table set to block, the caption loses its table box and collapses
     to one word per line unless it is given one of its own. */
  table.spec caption {
    display: block;
    width: 100%;
    padding-bottom: 10px;
  }

  table.spec thead {
    position: absolute;
    left: -9999px;
  }

  table.spec tbody tr {
    padding: 12px 0 14px;
    border-bottom: 1px solid #14181c;
  }

  table.spec tbody tr:hover {
    background: none;
  }

  table.spec tbody th {
    padding: 0 0 6px;
    border: 0;
    font-size: 1.0625rem;
    white-space: normal;
  }

  table.spec td {
    display: grid;
    grid-template-columns: 6.5rem 1fr;
    gap: 0 14px;
    padding: 3px 0;
    border: 0;
  }

  table.spec td::before {
    content: attr(data-label);
    font-family: 'Archivo Narrow', 'Archivo', sans-serif;
    font-weight: 700;
    font-size: 0.75rem;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: #4a5560;
    padding-top: 2px;
  }

  table.spec td:first-of-type {
    padding-left: 0;
  }

  table.spec td a {
    justify-self: start;
  }

  .kv a {
    padding: 0 0 8px;
  }

  /* The wide diagram is unreadable at this width; the stacked variant carries
     the same topology at legible type. */
  .diagram svg.diagram-wide {
    display: none;
  }

  .diagram svg.diagram-tall {
    display: block;
  }
}

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

@media print {
  .toc,
  .post-nav {
    display: none;
  }

  a {
    color: #14181c;
    border: 0;
  }
}
