@font-face {
  font-family: 'Archivo';
  font-style: normal;
  font-weight: 400 800;
  font-stretch: 100%;
  font-display: swap;
  src: url(/fonts/archivo-vietnamese.woff2) format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
@font-face {
  font-family: 'Archivo';
  font-style: normal;
  font-weight: 400 800;
  font-stretch: 100%;
  font-display: swap;
  src: url(/fonts/archivo-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Archivo';
  font-style: normal;
  font-weight: 400 800;
  font-stretch: 100%;
  font-display: swap;
  src: url(/fonts/archivo-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Caveat';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(/fonts/caveat-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Caveat';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(/fonts/caveat-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --paper: #f4f2ee;
  --ink: #141412;
  --grey: #9a958c;
  --grey-dark: #6f6b64;
  --hairline: rgba(20, 20, 18, 0.14);
  --rule: rgba(20, 20, 18, 0.32);
  --grid: rgba(20, 20, 18, 0.07);
  --vignette: rgba(20, 20, 18, 0.08);
  --card: rgba(255, 255, 255, 0.55);
  --accent: #1c6df2;
  --accent-wash: rgba(28, 109, 242, 0.09);
  --on-accent: #ffffff;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --gap: clamp(1.5rem, 3vw, 2.5rem);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #161614;
    --ink: #ecebe7;
    --grey: #8f8a81;
    --grey-dark: #b0aba2;
    --hairline: rgba(236, 235, 231, 0.14);
    --rule: rgba(236, 235, 231, 0.34);
    --grid: rgba(236, 235, 231, 0.055);
    --vignette: rgba(0, 0, 0, 0.5);
    --card: rgba(255, 255, 255, 0.035);
    --accent: #6ea0ff;
    --accent-wash: rgba(110, 160, 255, 0.12);
    --on-accent: #161614;
    color-scheme: dark;
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
  scrollbar-color: var(--rule) var(--paper);
}

body {
  margin: 0;
  min-height: 100vh;
  padding: clamp(1.25rem, 3vw, 2.5rem) 6vw clamp(3rem, 6vw, 5rem);
  font-family: "Archivo", system-ui, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.55;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 32px 32px;
  background-attachment: fixed;
  box-shadow: inset 0 0 160px var(--vignette);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

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

a {
  color: var(--accent);
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent);
  transition: text-decoration-color 0.2s var(--ease);
}

a:hover {
  text-decoration-color: currentColor;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.05;
  text-wrap: balance;
}

p {
  margin: 0;
}

.label {
  display: block;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--grey-dark);
}

.sheet {
  max-width: 1320px;
  margin: 0 auto;
}

/* Title block */

.titleblock {
  display: grid;
  grid-template-columns: 1.4fr 1.2fr 1.2fr 1.2fr auto;
  border-bottom: 2px solid var(--ink);
}

.titleblock > div {
  padding: 0.75rem 1.25rem 0.85rem 0;
  min-width: 0;
}

.titleblock .value {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.9375rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.titleblock .name {
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
}

.pending {
  color: var(--grey-dark);
  font-style: italic;
  font-weight: 400;
}

/* Pills */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.4rem;
  border: 1px solid var(--ink);
  border-radius: 999px;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  transition:
    background-color 0.25s var(--ease),
    color 0.25s var(--ease),
    border-color 0.25s var(--ease);
}

.pill svg {
  width: 1rem;
  height: 1rem;
  transition: transform 0.3s var(--ease);
}

.pill:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.pill:hover svg {
  transform: translateX(3px);
}

.pill.primary {
  background: var(--ink);
  color: var(--paper);
}

.pill.primary:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

/* Cards and tables */

.card {
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  padding: clamp(1.25rem, 2vw, 1.75rem);
}

.card h2 {
  font-size: 1.125rem;
  letter-spacing: -0.01em;
  margin-bottom: 1rem;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  padding: 0 0.75rem 0.6rem 0;
  text-align: left;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--grey-dark);
}

td {
  padding: 0.8rem 0.75rem 0.8rem 0;
  border-top: 1px solid var(--hairline);
  vertical-align: top;
}

td.muted {
  color: var(--grey-dark);
}

td.nowrap {
  white-space: nowrap;
}

td.pass {
  color: var(--accent);
  font-weight: 700;
}

td .cond {
  display: block;
  font-size: 0.8125rem;
  color: var(--grey-dark);
}

/* First viewport */

.spec {
  display: grid;
  grid-template-columns: 7fr 5fr;
  gap: clamp(2rem, 5vw, 4.5rem);
  padding-top: clamp(2.5rem, 6vh, 4rem);
  align-items: start;
}

.part h1 {
  font-size: clamp(3.75rem, 9.2vw, 8.25rem);
  letter-spacing: -0.04em;
  line-height: 0.9;
}

.part .function {
  margin-top: 1.5rem;
  max-width: 34ch;
  font-size: clamp(1.25rem, 1.9vw, 1.625rem);
  font-weight: 500;
  line-height: 1.3;
}

.part .function strong {
  font-weight: 700;
}

.features {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 2rem;
  margin: 2.25rem 0 0;
  border-top: 1px solid var(--hairline);
}

.features div {
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--hairline);
}

.features dt {
  font-weight: 700;
}

.features dd {
  margin: 0.1rem 0 0;
  color: var(--grey-dark);
  font-size: 0.9375rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 2rem;
}

.readout {
  display: grid;
  gap: 1rem;
}

.readout .conditions {
  margin-top: 1rem;
  font-size: 0.875rem;
  color: var(--grey-dark);
}

.annotation {
  display: inline-block;
  margin-top: 1rem;
  font-family: "Caveat", cursive;
  font-size: 1.6rem;
  font-weight: 500;
  line-height: 1.3;
  color: var(--accent);
  transform: rotate(-1.5deg);
  transform-origin: left center;
}

/* The results table runs once, like a test log: each row is swept as it
   completes. The rows themselves are always visible. */

.log tbody tr {
  background: linear-gradient(var(--sweep, var(--accent-wash)), var(--sweep, var(--accent-wash))) no-repeat left bottom / 0% 100%;
}

.log tbody tr:first-child {
  --sweep: var(--grid);
}

@media (prefers-reduced-motion: no-preference) {
  .log tbody tr {
    animation: run 1.1s var(--ease) both;
  }

  .log tbody tr:nth-child(1) {
    animation-delay: 0.3s;
  }

  .log tbody tr:nth-child(2) {
    animation-delay: 0.85s;
  }

  .annotation {
    animation: settle 0.9s var(--ease) 1.6s both;
  }
}

@keyframes run {
  0% {
    background-size: 0% 100%;
  }
  55% {
    background-size: 100% 100%;
  }
  100% {
    background-size: 100% 0%;
  }
}

@keyframes settle {
  from {
    filter: blur(2px);
    transform: rotate(-4deg) translateY(4px);
  }
}

/* Sections below the fold */

.section {
  margin-top: clamp(4.5rem, 10vw, 7.5rem);
  padding-top: 1.25rem;
  border-top: 2px solid var(--ink);
}

.section > header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1.5rem;
  margin-bottom: clamp(1.5rem, 3vw, 2.25rem);
}

.section h2 {
  font-size: clamp(1.75rem, 3.2vw, 2.5rem);
}

.section > header p {
  max-width: 46ch;
  text-wrap: balance;
  color: var(--grey-dark);
  font-size: 0.9375rem;
  text-align: right;
}

/* Functional block diagram: a schematic, square ink blocks joined by
   labelled signal lines, drawn straight on the paper. */

.diagram {
  display: grid;
  grid-template-columns:
    minmax(min-content, 0.9fr) 5.75rem minmax(min-content, 3.9fr) 7rem
    minmax(min-content, 1.1fr) 4.5rem minmax(min-content, 0.7fr);
  align-items: stretch;
}

.node {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 1rem;
  border: 1.5px solid var(--ink);
  font-weight: 700;
  line-height: 1.3;
  white-space: nowrap;
}

.node small {
  white-space: normal;
  margin-top: 0.2rem;
  font-weight: 400;
  font-size: 0.8125rem;
  color: var(--grey-dark);
}

.node.lib {
  padding: 0;
  justify-content: stretch;
}

.node-title {
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--ink);
}

.stages {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stage {
  padding: 0.85rem 0.8rem;
  font-weight: 600;
  font-size: 0.9375rem;
  line-height: 1.35;
  outline: 1px solid transparent;
  outline-offset: -1px;
  transition:
    background-color 0.3s var(--ease),
    outline-color 0.3s var(--ease),
    color 0.3s var(--ease);
}

.stage + .stage {
  border-left: 1px solid var(--hairline);
}

.stage small {
  display: block;
  margin-top: 0.25rem;
  font-weight: 400;
  font-size: 0.8125rem;
  color: var(--grey-dark);
}

.wire {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wire::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  right: 7px;
  height: 1px;
  background: var(--ink);
}

.wire::after {
  content: "";
  position: absolute;
  top: calc(50% - 4.5px);
  right: 0;
  width: 8px;
  height: 9px;
  background: var(--ink);
  clip-path: polygon(0 0, 100% 50%, 0 100%);
}

.wire span {
  transform: translateY(-1rem);
  padding: 0 0.4rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--grey-dark);
  white-space: nowrap;
}

.stage-table tbody tr {
  cursor: pointer;
  transition: background-color 0.3s var(--ease);
}

.stage-table tbody tr:focus {
  outline: none;
}

.stage-table tbody tr:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.chars {
  font-size: 0.9375rem;
}

.chars td:nth-child(2) {
  white-space: nowrap;
}

.chars td:last-child {
  font-size: 0.875rem;
}

.chars code {
  white-space: nowrap;
}

.stage-table td:first-child {
  font-weight: 700;
  white-space: nowrap;
}

.stage-table td:last-child {
  color: var(--grey-dark);
}

.diagram-wrap:has(tr[data-stage]:is(:hover, :focus)) .stage {
  color: var(--grey);
}

.diagram-wrap:has(tr[data-stage="headers"]:is(:hover, :focus)) .stage[data-stage="headers"],
.diagram-wrap:has(tr[data-stage="tls"]:is(:hover, :focus)) .stage[data-stage="tls"],
.diagram-wrap:has(tr[data-stage="h2"]:is(:hover, :focus)) .stage[data-stage="h2"],
.diagram-wrap:has(tr[data-stage="solver"]:is(:hover, :focus)) .stage[data-stage="solver"] {
  color: var(--ink);
  background: var(--accent-wash);
  outline-color: var(--accent);
}

.stage-table tbody tr:is(:hover, :focus) {
  background: var(--accent-wash);
}

.diagram-wrap {
  display: grid;
  gap: 2rem;
}

/* Two-column notes: limits and application notes */

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

.limits {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--hairline);
}

.limits li {
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--hairline);
  color: var(--grey-dark);
}

.limits strong {
  display: block;
  color: var(--ink);
}

.note-link {
  display: block;
  color: inherit;
  text-decoration: none;
  transition: border-color 0.3s var(--ease);
}

.note-link:hover {
  border-color: var(--accent);
}

.note-link h3 {
  font-size: clamp(1.375rem, 2.2vw, 1.75rem);
}

.note-link .label {
  margin: 0.5rem 0 0.9rem;
}

.note-link p {
  color: var(--grey-dark);
  max-width: 52ch;
}

.note-link .more {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 1.25rem;
  font-weight: 600;
  color: var(--accent);
}

.note-link .more svg {
  width: 1rem;
  height: 1rem;
  transition: transform 0.3s var(--ease);
}

.note-link:hover .more svg {
  transform: translateX(4px);
}

/* Engineer of record */

.engineer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--gap);
  align-items: end;
}

.engineer .who {
  margin-top: 0.75rem;
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
}

.bio-placeholder {
  margin-top: 1rem;
  padding: 1rem 1.25rem;
  border: 1px dashed var(--rule);
  border-radius: 8px;
  color: var(--grey-dark);
  max-width: 48ch;
}

.engineer .actions {
  justify-content: flex-end;
}

.colophon {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: clamp(3rem, 6vw, 4.5rem);
  padding-top: 0.75rem;
  border-top: 1px solid var(--hairline);
  font-size: 0.8125rem;
  color: var(--grey-dark);
}

/* Write-up (Read surface) */

.article {
  max-width: 68ch;
  margin: clamp(2.5rem, 6vw, 4.5rem) auto 0;
}

.article h1 {
  font-size: clamp(2.5rem, 5.4vw, 4rem);
  letter-spacing: -0.04em;
}

.article .standfirst {
  margin-top: 1.25rem;
  font-size: 1.25rem;
  line-height: 1.45;
  color: var(--grey-dark);
}

.article .byline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.5rem;
  margin-top: 1.5rem;
  padding: 0.75rem 0;
  border-block: 1px solid var(--hairline);
  font-size: 0.875rem;
  color: var(--grey-dark);
}

.article h2 {
  margin: 3rem 0 0.9rem;
  font-size: 1.625rem;
  letter-spacing: -0.02em;
}

.article p + p,
.article p + pre,
.article pre + p,
.article ul + p,
.article p + ul,
.article p + figure,
.article figure + p {
  margin-top: 1.1rem;
}

.article ul {
  padding-left: 1.2rem;
}

.article li + li {
  margin-top: 0.5rem;
}

code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.875em;
}

:not(pre) > code {
  padding: 0.1em 0.35em;
  border: 1px solid var(--hairline);
  border-radius: 4px;
  background: var(--card);
}

pre {
  tab-size: 4;
  margin: 0;
  padding: 1.1rem 1.25rem;
  overflow-x: auto;
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  line-height: 1.5;
}

figure {
  margin: 0;
}

figcaption {
  margin-top: 0.6rem;
  font-size: 0.875rem;
  color: var(--grey-dark);
}

.back {
  display: inline-block;
  margin-top: 3rem;
  font-weight: 600;
}

/* Small screens */

@media (max-width: 1000px) {
  .titleblock {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .titleblock .sheetno {
    display: none;
  }

  .spec,
  .columns,
  .engineer {
    grid-template-columns: minmax(0, 1fr);
  }

  .engineer .actions {
    justify-content: flex-start;
  }

  .diagram {
    grid-template-columns: minmax(0, 1fr);
  }

  .wire {
    height: 3.5rem;
    justify-content: flex-start;
  }

  .wire::before {
    top: 0;
    bottom: 7px;
    left: 50%;
    right: auto;
    width: 1px;
    height: auto;
  }

  .wire::after {
    top: auto;
    bottom: 0;
    left: calc(50% - 4.5px);
    right: auto;
    width: 9px;
    height: 8px;
    clip-path: polygon(0 0, 100% 0, 50% 100%);
  }

  .wire span {
    transform: none;
    margin-left: calc(50% + 0.5rem);
  }

  .stages {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stage:nth-child(3) {
    border-left: 0;
  }

  .stage:nth-child(n + 3) {
    border-top: 1px solid var(--hairline);
  }

  .section > header {
    flex-direction: column;
    align-items: flex-start;
  }

  .section > header p {
    text-align: left;
  }
}

@media (max-width: 560px) {
  .features {
    grid-template-columns: minmax(0, 1fr);
  }

  .log {
    font-size: 0.9375rem;
  }

  .log td {
    white-space: nowrap;
  }

  .chars thead,
  .revisions thead {
    display: none;
  }

  .chars tr,
  .revisions tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 1rem;
    padding: 0.8rem 0;
    border-top: 1px solid var(--hairline);
  }

  .chars td,
  .revisions td {
    padding: 0;
    border: 0;
  }

  .chars td:last-child,
  .revisions td:last-child {
    grid-column: 1 / -1;
    margin-top: 0.3rem;
  }

  .chars td:last-child {
    font-size: 0.8125rem;
  }

  .revisions td:first-child {
    font-weight: 700;
  }

  .stage-table thead {
    display: none;
  }

  .stage-table,
  .stage-table tbody,
  .stage-table tr,
  .stage-table td {
    display: block;
  }

  .stage-table tr {
    padding: 0.9rem 0.5rem;
    border-top: 1px solid var(--hairline);
  }

  .stage-table td {
    padding: 0;
    border: 0;
  }

  .stage-table td + td {
    margin-top: 0.35rem;
  }

  .stage-table td:last-child {
    font-size: 0.9375rem;
  }

  .colophon {
    flex-direction: column;
  }
}
