/* ==========================================================================
   Apraide.lv — "Labelled Enclosure"
   The site is the inside of a member-built node: matte black enclosure,
   steel DIN rail, label-maker tape, one signal-red LED for state.
   ========================================================================== */

@font-face {
  font-family: "Archivo";
  src: url("/assets/fonts/archivo-var.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("/assets/fonts/jetbrainsmono-var.woff2") format("woff2");
  font-weight: 100 800;
  font-display: swap;
}

:root {
  /* Enclosure */
  --ground: #0c0d0e;
  --plate: #131517;
  --plate-hi: #1a1d20;
  --rule: #25292d;
  --rule-hi: #363b41;
  --steel: #8e939a;
  --ink: #ecebe6;
  --ink-2: #c4c5c2;

  /* State — the only colour in the world */
  --signal: #f0502f;
  --signal-off: #26292c;

  /* Type */
  --font: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --fs-label: 0.6875rem;
  --fs-small: 0.875rem;
  --fs-body: 1.0625rem;
  --fs-lede: clamp(1.125rem, 0.9rem + 0.7vw, 1.375rem);
  --fs-h3: clamp(1.125rem, 1rem + 0.4vw, 1.3125rem);
  --fs-h2: clamp(1.875rem, 1.2rem + 2.4vw, 3.25rem);
  --fs-h1: clamp(2.375rem, 0.9rem + 5.6vw, 6rem);

  /* Space */
  --s1: 0.25rem;
  --s2: 0.5rem;
  --s3: 0.75rem;
  --s4: 1rem;
  --s5: 1.5rem;
  --s6: 2rem;
  --s7: 3rem;
  --s8: 4.5rem;
  --s9: 7rem;

  --gutter: clamp(1rem, 4vw, 3rem);
  --page: 80rem;
  --measure: 68ch;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);

  color-scheme: dark;
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scrollbar-color: var(--rule-hi) var(--ground);
  scroll-padding-top: var(--s7);
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--ground);
  color: var(--ink-2);
  font-family: var(--font);
  font-size: var(--fs-body);
  font-weight: 380;
  font-stretch: 100%;
  line-height: 1.65;
  font-kerning: normal;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  caret-color: var(--signal);
}

::selection {
  background: var(--ink);
  color: var(--ground);
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--ground);
}

::-webkit-scrollbar-thumb {
  background: var(--rule-hi);
  border: 3px solid var(--ground);
  border-radius: 10px;
}

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

h1,
h2,
h3,
h4 {
  margin: 0;
  color: var(--ink);
  font-weight: 220;
  font-stretch: 125%;
  line-height: 1.04;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

h1 {
  font-size: var(--fs-h1);
  font-weight: 180;
  line-height: 0.98;
  letter-spacing: -0.03em;
}

h2 {
  font-size: var(--fs-h2);
}

h3 {
  font-size: var(--fs-h3);
  font-weight: 460;
  font-stretch: 112%;
  line-height: 1.25;
  letter-spacing: 0;
}

h4 {
  font-size: var(--fs-body);
  font-weight: 560;
  font-stretch: 100%;
  line-height: 1.35;
  letter-spacing: 0;
}

p {
  margin: 0 0 var(--s4);
  text-wrap: pretty;
}

strong,
b {
  color: var(--ink);
  font-weight: 600;
}

a {
  color: var(--ink);
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--rule-hi);
  text-underline-offset: 0.22em;
  transition: text-decoration-color 160ms var(--ease-out), color 160ms var(--ease-out);
}

a:hover {
  text-decoration-color: var(--signal);
}

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

code,
kbd,
pre {
  font-family: var(--mono);
  font-variant-ligatures: none;
}

code {
  padding: 0.08em 0.4em;
  border: 1px solid var(--rule);
  border-radius: 3px;
  background: var(--plate);
  color: var(--ink);
  font-size: 0.86em;
  white-space: break-spaces;
}

hr {
  height: 1px;
  margin: var(--s7) 0;
  border: 0;
  background: var(--rule);
}

ul,
ol {
  margin: 0 0 var(--s4);
  padding-left: 1.25em;
}

li + li {
  margin-top: var(--s2);
}

li::marker {
  color: var(--steel);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

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

.skip-link {
  position: absolute;
  top: var(--s3);
  left: var(--s3);
  z-index: 100;
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: none;
}

.icon {
  display: inline-block;
  width: 1em;
  height: 1em;
  flex: none;
  vertical-align: -0.125em;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: square;
  stroke-linejoin: miter;
}

/* --------------------------------------------------------------------------
   Label-maker tape
   -------------------------------------------------------------------------- */

.tape {
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  padding: 0.34em 0.75em 0.3em;
  border-radius: 1.5px;
  background: #050506;
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.08), 0 1px 2px rgb(0 0 0 / 0.6);
  color: var(--ink);
  font-size: var(--fs-label);
  font-weight: 560;
  font-stretch: 118%;
  line-height: 1.2;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  white-space: nowrap;
}

.tape--white {
  background: var(--ink);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.5);
  color: var(--ground);
}

/* --------------------------------------------------------------------------
   LED
   -------------------------------------------------------------------------- */

.led {
  display: inline-block;
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  background: var(--signal-off);
  box-shadow: inset 0 1px 1px rgb(0 0 0 / 0.6);
  transition: background-color 90ms linear, box-shadow 90ms linear;
}

.led.is-lit,
.is-lit > .led,
a:hover > .led,
a:focus-visible > .led {
  background: var(--signal);
  box-shadow: none;
}

/* --------------------------------------------------------------------------
   Page frame
   -------------------------------------------------------------------------- */

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

main {
  flex: 1;
}

/* Header: a strip of tape and terminal labels */

.site-header {
  position: relative;
  z-index: 20;
  border-bottom: 1px solid var(--rule);
  background: var(--ground);
}

.site-header .frame {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s5);
  min-height: 4rem;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: var(--s3);
  text-decoration: none;
}

.wordmark .tape {
  font-size: 0.75rem;
  letter-spacing: 0.2em;
}

.wordmark-meta {
  color: var(--steel);
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.nav-list {
  display: flex;
  align-items: center;
  gap: clamp(var(--s3), 1.6vw, var(--s5));
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav-list li + li {
  margin: 0;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  padding-block: var(--s2);
  color: var(--steel);
  font-size: 0.8125rem;
  font-weight: 460;
  font-stretch: 108%;
  letter-spacing: 0.04em;
  text-decoration: none;
  white-space: nowrap;
  transition: color 160ms var(--ease-out);
}

.nav-link:hover,
.nav-link[aria-current="page"] {
  color: var(--ink);
}

.nav-link .led {
  width: 5px;
  height: 5px;
}

.nav-link .icon {
  width: 0.7em;
  height: 0.7em;
  opacity: 0.7;
}

.nav-toggle {
  display: none;
  align-items: center;
  gap: var(--s2);
  padding: var(--s2) var(--s3);
  border: 1px solid var(--rule-hi);
  border-radius: 2px;
  background: var(--plate);
  color: var(--ink);
  font: inherit;
  font-size: 0.8125rem;
  font-stretch: 112%;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}

.nav-toggle .icon {
  width: 1.1em;
  height: 1.1em;
}

@media (max-width: 1100px) {
  .wordmark-meta {
    display: none;
  }
}

@media (max-width: 900px) {
  .nav-toggle {
    display: inline-flex;
  }

  .site-nav {
    position: absolute;
    top: 100%;
    right: 0;
    left: 0;
    display: none;
    border-bottom: 1px solid var(--rule);
    background: var(--ground);
  }

  .site-nav.is-open {
    display: block;
  }

  .nav-list {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: var(--s2) var(--gutter) var(--s4);
  }

  .nav-list li + li {
    border-top: 1px solid var(--rule);
  }

  .nav-link {
    width: 100%;
    padding-block: var(--s4);
    font-size: 0.9375rem;
  }
}

/* Footer */

.site-footer {
  margin-top: var(--s9);
  border-top: 1px solid var(--rule);
  color: var(--steel);
  font-size: var(--fs-small);
}

.site-footer .frame {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s4) var(--s6);
  padding-block: var(--s6);
}

.site-footer p {
  margin: 0;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2) var(--s5);
  margin: 0;
  padding: 0;
  list-style: none;
}

.footer-links li + li {
  margin: 0;
}

.footer-links a {
  color: var(--steel);
  text-decoration: none;
}

.footer-links a:hover {
  color: var(--ink);
}

/* --------------------------------------------------------------------------
   DIN rail and modules (the signature)
   -------------------------------------------------------------------------- */

.rail-zone {
  position: relative;
  --rail-h: 2.25rem;
}

.rail {
  position: absolute;
  top: 50%;
  right: 0;
  left: 0;
  height: var(--rail-h);
  transform: translateY(-50%);
  border-block: 1px solid var(--rule-hi);
  background:
    linear-gradient(180deg, transparent 0 22%, var(--rule) 22% 23%, transparent 23% 77%, var(--rule) 77% 78%, transparent 78%),
    repeating-linear-gradient(90deg, transparent 0 14px, var(--ground) 14px 30px, transparent 30px 44px) center / 100% 26% no-repeat,
    #181b1e;
}

/* positioned by the relay script; invisible until it moves */
.packet {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
  width: 18px;
  height: 2px;
  background: var(--signal);
  opacity: 0;
  pointer-events: none;
  will-change: transform, opacity;
}

.modules {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 3.4fr 2.6fr 2.8fr 3.1fr;
  align-items: stretch;
  gap: clamp(0.75rem, 1.8vw, 1.75rem);
  margin: 0;
  padding: 0;
  list-style: none;
}

.modules li + li {
  margin: 0;
}

.module {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--s3);
  height: 100%;
  min-height: 14.5rem;
  padding: var(--s5) var(--s4) var(--s4);
  border: 1px solid var(--rule-hi);
  border-radius: 3px;
  background: var(--plate);
  box-shadow: 0 14px 24px -12px rgb(0 0 0 / 0.8);
  color: var(--ink-2);
  text-decoration: none;
  transition: border-color 200ms var(--ease-out), background-color 200ms var(--ease-out), transform 260ms var(--ease-out);
}

/* terminal screws, top corners */
.module::before,
.module::after {
  content: "";
  position: absolute;
  top: 0.55rem;
  width: 9px;
  height: 9px;
  border: 1px solid var(--rule-hi);
  border-radius: 50%;
  background: linear-gradient(45deg, transparent 43%, var(--rule-hi) 43% 57%, transparent 57%), var(--ground);
}

.module::before {
  left: 0.55rem;
}

.module::after {
  right: 0.55rem;
}

.module-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  margin-top: var(--s2);
}

.module-index {
  color: var(--steel);
  font-family: var(--mono);
  font-size: 0.6875rem;
}

.module-value {
  color: var(--ink);
  font-family: var(--mono);
  font-size: clamp(1rem, 0.7rem + 0.9vw, 1.375rem);
  font-weight: 300;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.module p {
  margin: 0;
  font-size: var(--fs-small);
  line-height: 1.55;
}

.module-action {
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  margin-top: auto;
  padding-top: var(--s3);
  border-top: 1px solid var(--rule);
  color: var(--ink);
  font-size: var(--fs-small);
  font-weight: 520;
  font-stretch: 108%;
}

.module-action .icon {
  transition: transform 240ms var(--ease-out);
}

a.module:hover,
a.module:focus-visible {
  border-color: var(--steel);
  transform: translateY(-2px);
}

a.module:hover .module-action .icon,
a.module:focus-visible .module-action .icon {
  transform: translateX(3px);
}

a.module:hover .led,
a.module:focus-visible .led {
  background: var(--signal);
  box-shadow: none;
}

/* the primary module: white label tape over the whole face */
.module--primary {
  border-color: transparent;
  background: var(--ink);
  box-shadow: 0 18px 30px -14px rgb(0 0 0 / 0.9);
  color: #2b2d30;
}

.module--primary .module-index {
  color: #5d6066;
}

.module--primary .module-value,
.module--primary .module-action {
  color: var(--ground);
}

.module--primary .module-action {
  border-top-color: rgb(12 13 14 / 0.14);
}

.module--primary .led {
  background: #c9c7c0;
}

a.module--primary:hover,
a.module--primary:focus-visible {
  border-color: transparent;
}

.module--primary::before,
.module--primary::after {
  border-color: #a9a8a2;
  background: linear-gradient(45deg, transparent 43%, #a9a8a2 43% 57%, transparent 57%), var(--ink);
}

@media (max-width: 860px) {
  .rail-zone {
    padding-left: calc(var(--rail-h) + var(--s4));
  }

  .rail {
    top: 0;
    bottom: 0;
    left: 0;
    right: auto;
    width: var(--rail-h);
    height: auto;
    transform: none;
    border-block: 0;
    border-inline: 1px solid var(--rule-hi);
    background:
      linear-gradient(90deg, transparent 0 22%, var(--rule) 22% 23%, transparent 23% 77%, var(--rule) 77% 78%, transparent 78%),
      repeating-linear-gradient(180deg, transparent 0 14px, var(--ground) 14px 30px, transparent 30px 44px) center / 26% 100% no-repeat,
      #181b1e;
  }

  .rail-zone .packet {
    width: 2px;
    height: 18px;
  }

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

  .module {
    min-height: 0;
  }

  /* the module still clips onto the rail */
  .modules > li {
    position: relative;
  }

  .modules > li::before {
    content: "";
    position: absolute;
    top: 50%;
    left: calc(-1 * var(--s4) - var(--rail-h) * 0.25);
    width: calc(var(--s4) + var(--rail-h) * 0.25);
    height: 1.5rem;
    transform: translateY(-50%);
    border: 1px solid var(--rule-hi);
    border-right: 0;
    background: var(--plate);
  }
}

/* --------------------------------------------------------------------------
   Homepage
   -------------------------------------------------------------------------- */

.hero {
  position: relative;
  overflow: hidden;
  padding-block: clamp(var(--s7), 7vw, var(--s9)) clamp(var(--s7), 6vw, var(--s8));
}

/* perforated backplate */
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image: radial-gradient(circle, #1e2125 1.1px, transparent 1.6px);
  background-size: 12px 12px;
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 18%, #000 72%, transparent);
  mask-image: linear-gradient(180deg, transparent, #000 18%, #000 72%, transparent);
}

.hero-copy {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  align-items: end;
  gap: var(--s5) var(--s6);
  margin-bottom: clamp(var(--s7), 6vw, var(--s8));
}

.hero-copy h1 {
  grid-column: 1 / span 8;
  max-width: 13ch;
}

.hero-lede {
  grid-column: 9 / span 4;
  margin: 0;
  padding-bottom: 0.6em;
  color: var(--ink-2);
  font-size: var(--fs-lede);
  font-weight: 320;
  line-height: 1.5;
}

.hero-lede strong {
  font-weight: 500;
}

@media (max-width: 1100px) {
  .hero-copy h1 {
    grid-column: 1 / -1;
  }

  .hero-lede {
    grid-column: 1 / span 9;
  }
}

@media (max-width: 640px) {
  .hero-lede {
    grid-column: 1 / -1;
  }
}

/* sections */

/* every section joint is a short length of the same DIN rail */
.band,
.closing {
  position: relative;
}

.band::before,
.closing::before {
  content: "";
  position: absolute;
  top: -6px;
  right: 0;
  left: 0;
  height: 12px;
  border-block: 1px solid var(--rule-hi);
  background:
    repeating-linear-gradient(90deg, transparent 0 14px, var(--ground) 14px 30px, transparent 30px 44px) center / 100% 4px no-repeat,
    #15181b;
}

.band {
  padding-block: clamp(var(--s8), 9vw, var(--s9));
}

.band-head {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--s5) var(--s6);
  margin-bottom: clamp(var(--s6), 4vw, var(--s7));
}

.band-head h2 {
  grid-column: 1 / span 7;
}

.band-head p {
  grid-column: 8 / span 5;
  align-self: end;
  margin: 0;
  font-size: var(--fs-lede);
  font-weight: 320;
  line-height: 1.5;
}

@media (max-width: 960px) {
  .band-head h2,
  .band-head p {
    grid-column: 1 / -1;
  }
}

/* How it works: relay schematic */

.relay {
  margin: 0;
}

.relay-chain {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: center;
  margin: 0;
  padding: 0;
  list-style: none;
}

.relay-chain li + li {
  margin: 0;
}

.station {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s3);
  text-align: center;
}

.station + .station::before {
  content: "";
  position: absolute;
  top: 2.1rem;
  right: calc(50% + 2.4rem);
  left: calc(-50% + 2.4rem);
  height: 0;
  border-top: 1px dashed var(--rule-hi);
}

.station[data-link="lora"]::before {
  border-top: 1px solid var(--steel);
}

.relay-zone {
  position: relative;
}

.relay-zone .packet {
  z-index: 1;
  width: 6px;
  height: 6px;
  border-radius: 1px;
}

.station-box {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  flex: none;
  width: 4.2rem;
  height: 4.2rem;
  border: 1px solid var(--rule-hi);
  border-radius: 3px;
  background: var(--plate);
  color: var(--ink);
}

.station-box .icon {
  width: 1.6rem;
  height: 1.6rem;
  stroke-width: 1.25;
}

.station-box .led {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 5px;
  height: 5px;
}

.station-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
}

.station-name {
  color: var(--ink);
  font-size: var(--fs-small);
  font-weight: 520;
  line-height: 1.3;
}

.station-role {
  color: var(--steel);
  font-size: 0.8125rem;
  line-height: 1.35;
}

.link-label {
  position: absolute;
  top: 0.9rem;
  left: -50%;
  width: 100%;
  color: var(--steel);
  font-family: var(--mono);
  font-size: 0.625rem;
  letter-spacing: 0.04em;
  text-align: center;
}

.relay figcaption {
  max-width: 52ch;
  margin-top: var(--s6);
  color: var(--steel);
  font-size: var(--fs-small);
}

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

.how-grid .relay {
  grid-column: 1 / -1;
  padding: clamp(var(--s5), 4vw, var(--s7)) clamp(var(--s3), 3vw, var(--s6));
  border: 1px solid var(--rule);
  border-radius: 3px;
  background: var(--plate);
}

.how-grid .prose {
  grid-column: 1 / span 6;
}

.how-grid .prose + .prose {
  grid-column: 7 / span 6;
}

@media (max-width: 860px) {
  .how-grid .prose,
  .how-grid .prose + .prose {
    grid-column: 1 / -1;
  }

  .relay-chain {
    grid-template-columns: 1fr;
    justify-items: start;
    gap: var(--s5);
  }

  .station {
    flex-direction: row;
    gap: var(--s4);
    text-align: left;
  }

  .station + .station::before {
    top: auto;
    right: auto;
    bottom: calc(100% + 0.15rem);
    left: 2.1rem;
    width: 0;
    height: calc(var(--s5) - 0.3rem);
    border-top: 0;
    border-left: 1px dashed var(--rule-hi);
  }

  .station[data-link="lora"]::before {
    border-top: 0;
    border-left: 1px solid var(--steel);
  }

  .station-text {
    align-items: flex-start;
    gap: var(--s1);
  }

  .station-role {
    margin: 0;
  }

  .link-label {
    top: auto;
    bottom: calc(100% + 0.1rem);
    left: 3rem;
    width: auto;
    text-align: left;
  }
}

/* Annotated node photo */

.anatomy {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--s7) var(--s6);
  align-items: start;
}

.anatomy-figure {
  position: relative;
  grid-column: 1 / span 7;
  margin: 0;
}

.anatomy-photo {
  position: relative;
}

.anatomy-photo img {
  width: 100%;
  border: 1px solid var(--rule);
  border-radius: 3px;
  background: var(--plate);
  filter: grayscale(1) contrast(1.08) brightness(0.9);
  transition: filter 700ms var(--ease-out);
}

.anatomy-figure:hover .anatomy-photo img,
.anatomy-figure:focus-within .anatomy-photo img {
  filter: none;
}

.callouts {
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  pointer-events: none;
}

.callouts li + li {
  margin: 0;
}

/* each callout runs from its part (--x, --y) to the label column on the open lid */
.callout {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: calc(var(--col, 78%) - var(--x));
  height: 0;
}

/* the point on the part */
.callout::before {
  content: "";
  position: absolute;
  top: -5px;
  left: -5px;
  width: 10px;
  height: 10px;
  border: 1.5px solid var(--ink);
  border-radius: 50%;
  background: rgb(12 13 14 / 0.4);
  box-shadow: 0 0 0 1px rgb(0 0 0 / 0.5);
}

/* the leader line */
.callout::after {
  content: "";
  position: absolute;
  top: 0;
  left: 5px;
  right: 0;
  height: 1px;
  background: var(--ink);
  box-shadow: 0 1px 0 rgb(0 0 0 / 0.6);
}

.callout .tape {
  position: absolute;
  top: 0;
  left: 100%;
  transform: translateY(-50%);
  padding-inline: 0.55em;
  letter-spacing: 0.08em;
}

.callout-num {
  color: var(--steel);
  font-family: var(--mono);
  letter-spacing: 0;
}

.anatomy-figure figcaption {
  margin-top: var(--s3);
  color: var(--steel);
  font-size: 0.8125rem;
}

.anatomy-text {
  grid-column: 9 / span 4;
  position: sticky;
  top: var(--s6);
}

.anatomy-text h2 {
  margin-bottom: var(--s5);
}

.parts-key {
  margin: var(--s6) 0 0;
  padding: 0;
  list-style: none;
  counter-reset: part;
  border-top: 1px solid var(--rule);
}

.parts-key li {
  display: grid;
  grid-template-columns: 2rem 1fr;
  margin: 0;
  padding-block: var(--s2);
  border-bottom: 1px solid var(--rule);
  font-size: var(--fs-small);
}

.parts-key li::before {
  counter-increment: part;
  content: counter(part, decimal-leading-zero);
  color: var(--steel);
  font-family: var(--mono);
  font-size: 0.75rem;
  line-height: 1.9;
}

@media (max-width: 960px) {
  .anatomy-figure,
  .anatomy-text {
    grid-column: 1 / -1;
    position: static;
  }
}

/* on small screens labels move to the key; the photo keeps numbered points */
@media (max-width: 720px) {
  .callout::after,
  .callout .tape .callout-text {
    display: none;
  }

  .callout {
    width: 0;
  }

  .callout .tape {
    left: 9px;
    padding: 0.3em 0.45em;
    letter-spacing: 0;
  }
}

/* Why: terminal strip */

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

.terminals > li {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--s4) var(--s6);
  margin: 0;
  padding-block: clamp(var(--s5), 3vw, var(--s6));
  border-bottom: 1px solid var(--rule);
}

.terminals h3 {
  grid-column: 1 / span 5;
  font-size: clamp(1.25rem, 1rem + 0.9vw, 1.75rem);
  font-weight: 260;
  font-stretch: 118%;
  line-height: 1.2;
}

.terminals p {
  grid-column: 8 / span 5;
  margin: 0;
}

@media (max-width: 960px) {
  .terminals h3,
  .terminals p {
    grid-column: 1 / -1;
  }
}

/* Where to start: node types */

.node-types {
  width: 100%;
  border-top: 1px solid var(--ink);
}

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

.node-types thead th {
  padding-block: var(--s3);
  color: var(--steel);
  font-size: var(--fs-label);
  font-weight: 560;
  font-stretch: 118%;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.node-types tbody th {
  color: var(--ink);
  font-size: var(--fs-h3);
  font-weight: 300;
  font-stretch: 118%;
  line-height: 1.25;
}

.node-types tbody th .tape {
  margin-top: var(--s3);
}

.node-types td {
  font-size: var(--fs-small);
}

@media (max-width: 760px) {
  .node-types thead {
    display: none;
  }

  .node-types,
  .node-types tbody,
  .node-types tr,
  .node-types th,
  .node-types td {
    display: block;
    width: 100%;
  }

  .node-types tr {
    padding-block: var(--s4);
    border-bottom: 1px solid var(--rule);
  }

  .node-types th,
  .node-types td {
    padding: var(--s1) 0;
    border: 0;
  }

  .node-types td::before {
    content: attr(data-label) " ";
    color: var(--steel);
    font-size: var(--fs-label);
    font-stretch: 118%;
    letter-spacing: 0.14em;
    text-transform: uppercase;
  }
}

/* the node-types table with a handheld beside it */
.start-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--s6);
  align-items: start;
}

.start-main {
  grid-column: 1 / span 8;
  min-width: 0;
}

.start-photo {
  grid-column: 10 / span 3;
}

@media (max-width: 960px) {
  .start-main,
  .start-photo {
    grid-column: 1 / -1;
  }

  .start-photo {
    max-width: 20rem;
  }
}

.after-table {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s4) var(--s6);
  margin-top: var(--s6);
}

.after-table p {
  max-width: 60ch;
  margin: 0;
}

/* Buttons are label tape too */

.button {
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  padding: 0.85em 1.2em 0.8em;
  border: 0;
  border-radius: 2px;
  background: var(--ink);
  box-shadow: 0 8px 18px -8px rgb(0 0 0 / 0.9);
  color: var(--ground);
  font-family: var(--font);
  font-size: 0.8125rem;
  font-weight: 600;
  font-stretch: 118%;
  letter-spacing: 0.12em;
  text-decoration: none;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 220ms var(--ease-out), box-shadow 220ms var(--ease-out);
}

.button:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 22px -8px rgb(0 0 0 / 0.95);
}

.button .icon {
  transition: transform 240ms var(--ease-out);
}

.button:hover .icon {
  transform: translateX(3px);
}

.button--ghost {
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--rule-hi);
  color: var(--ink);
}

.button--ghost:hover {
  box-shadow: inset 0 0 0 1px var(--steel);
}

/* MeshCore aside */

.aside-line {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--s4) var(--s6);
  align-items: baseline;
}

.aside-line h2 {
  grid-column: 1 / span 5;
  font-size: clamp(1.5rem, 1.1rem + 1.4vw, 2.25rem);
}

.aside-line .prose {
  grid-column: 7 / span 6;
}

@media (max-width: 960px) {
  .aside-line h2,
  .aside-line .prose {
    grid-column: 1 / -1;
  }
}

/* Closing */

.closing {
  padding-block: clamp(var(--s8), 10vw, 9rem) 0;
}

.closing h2 {
  max-width: 14ch;
  font-size: clamp(2.25rem, 1rem + 4.6vw, 5rem);
  font-weight: 180;
  letter-spacing: -0.03em;
}

.closing-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--s6);
  align-items: start;
}

.closing-grid h2 {
  grid-column: 1 / span 7;
}

.closing-grid .closing-body {
  grid-column: 8 / span 5;
}

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

.exits li {
  margin: 0;
  border-bottom: 1px solid var(--rule);
}

.exits a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s4);
  padding-block: var(--s4);
  color: var(--ink);
  font-size: var(--fs-h3);
  font-weight: 300;
  font-stretch: 115%;
  text-decoration: none;
}

.exits a .exit-note {
  margin-left: auto;
  color: var(--steel);
  font-family: var(--mono);
  font-size: 0.75rem;
}

.exits a .icon {
  color: var(--steel);
  transition: transform 240ms var(--ease-out), color 160ms var(--ease-out);
}

.exits a:hover .icon {
  color: var(--ink);
  transform: translateX(3px);
}

@media (max-width: 960px) {
  .closing-grid h2,
  .closing-grid .closing-body {
    grid-column: 1 / -1;
  }
}

/* --------------------------------------------------------------------------
   Inner pages
   -------------------------------------------------------------------------- */

.page-head {
  padding-block: clamp(var(--s7), 6vw, var(--s8)) clamp(var(--s6), 4vw, var(--s7));
}

.page-head h1 {
  max-width: 16ch;
  font-size: clamp(2.25rem, 1rem + 4.2vw, 4.5rem);
}

.page-head .lede {
  max-width: 58ch;
  margin: var(--s5) 0 0;
  font-size: var(--fs-lede);
  font-weight: 320;
  line-height: 1.5;
}

.page-head--split {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--s6);
  align-items: end;
}

.page-head--split > div {
  grid-column: 1 / span 7;
}

.page-head--split > figure {
  grid-column: 8 / span 5;
  margin: 0;
}

@media (max-width: 960px) {
  .page-head--split > div,
  .page-head--split > figure {
    grid-column: 1 / -1;
  }
}

.plate-photo {
  margin: 0;
}

.plate-photo img {
  width: 100%;
  border: 1px solid var(--rule);
  border-radius: 3px;
  filter: grayscale(1) contrast(1.06) brightness(0.86);
  transition: filter 700ms var(--ease-out);
}

.plate-photo:hover img {
  filter: none;
}

.plate-photo figcaption {
  margin-top: var(--s3);
  color: var(--steel);
  font-size: 0.8125rem;
}

/* in-page index for long reference pages */
.page-index {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2) var(--s4);
  margin: 0;
  padding: var(--s4) 0;
  border-block: 1px solid var(--rule);
  list-style: none;
}

.page-index li + li {
  margin: 0;
}

.page-index a {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  color: var(--steel);
  font-size: 0.8125rem;
  font-stretch: 108%;
  letter-spacing: 0.03em;
  text-decoration: none;
}

.page-index a:hover {
  color: var(--ink);
}

.page-index .module-index {
  font-size: 0.6875rem;
}

.ref-section {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--s5) var(--s6);
  padding-block: clamp(var(--s7), 6vw, var(--s8));
  border-top: 1px solid var(--rule);
}

.ref-section:first-of-type {
  border-top: 0;
}

.ref-section > header {
  grid-column: 1 / span 4;
}

.ref-section > header h2 {
  font-size: clamp(1.5rem, 1.1rem + 1.4vw, 2.25rem);
}

.ref-section > header p {
  margin-top: var(--s4);
  color: var(--ink-2);
  font-size: var(--fs-small);
}

.ref-section > .ref-body {
  grid-column: 6 / span 7;
  min-width: 0;
}

@media (max-width: 960px) {
  .ref-section > header,
  .ref-section > .ref-body {
    grid-column: 1 / -1;
  }
}

/* parts list (devices) */

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

.parts > li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--s2) var(--s5);
  margin: 0;
  padding-block: var(--s4);
  border-bottom: 1px solid var(--rule);
}

.part-name {
  color: var(--ink);
  font-weight: 500;
}

.part-note {
  grid-column: 1;
  margin: 0;
  color: var(--ink-2);
  font-size: var(--fs-small);
}

.part-links {
  grid-column: 2;
  grid-row: 1 / span 2;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-content: start;
  gap: var(--s2);
}

.shop {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  padding: 0.3em 0.6em;
  border: 1px solid var(--rule-hi);
  border-radius: 2px;
  color: var(--ink-2);
  font-size: 0.75rem;
  font-weight: 480;
  font-stretch: 110%;
  letter-spacing: 0.04em;
  text-decoration: none;
  white-space: nowrap;
  transition: border-color 160ms var(--ease-out), color 160ms var(--ease-out);
}

.shop:hover {
  border-color: var(--steel);
  color: var(--ink);
}

.shop .icon {
  width: 0.75em;
  height: 0.75em;
}

/* a kit list: name and shop on one line */
.parts--bom .part-links {
  grid-row: 1;
}

@media (max-width: 600px) {
  .parts > li,
  .parts--bom > li {
    grid-template-columns: minmax(0, 1fr);
  }

  .part-links,
  .parts--bom .part-links {
    grid-column: 1;
    grid-row: auto;
    justify-content: flex-start;
  }

}

.note-line {
  display: flex;
  align-items: flex-start;
  gap: var(--s3);
  margin: var(--s5) 0 0;
  padding: var(--s4);
  border: 1px solid var(--rule-hi);
  border-radius: 3px;
  background: var(--plate);
  font-size: var(--fs-small);
}

.note-line .icon {
  width: 1.15rem;
  height: 1.15rem;
  margin-top: 0.1rem;
  color: var(--ink);
}

.note-line--warn .icon {
  color: var(--signal);
}

.note-line p {
  margin: 0;
}

.photo-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--s3);
  margin: var(--s5) 0 0;
  padding: 0;
  list-style: none;
}

.photo-strip li + li {
  margin: 0;
}

.photo-strip a {
  display: block;
  overflow: hidden;
  border: 1px solid var(--rule);
  border-radius: 3px;
}

.photo-strip img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  filter: grayscale(1) brightness(0.85);
  transition: filter 500ms var(--ease-out), transform 700ms var(--ease-out);
}

.photo-strip a:hover img,
.photo-strip a:focus-visible img {
  filter: none;
  transform: scale(1.03);
}

/* steps (join) */

.steps {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.steps > li {
  position: relative;
  display: grid;
  grid-template-columns: 3rem minmax(0, 1fr);
  gap: var(--s4);
  margin: 0;
  padding-bottom: var(--s5);
}

.steps > li::before {
  counter-increment: step;
  content: counter(step);
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border: 1px solid var(--rule-hi);
  border-radius: 50%;
  background: var(--plate);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.8125rem;
}

.steps > li:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 2.5rem;
  bottom: 0.25rem;
  left: calc(1.125rem - 0.5px);
  width: 1px;
  background: var(--rule-hi);
}

.steps > li > div {
  padding-top: 0.35rem;
}

.steps h3 {
  margin-bottom: var(--s1);
}

.steps p {
  margin: 0;
  font-size: var(--fs-small);
}

/* spec sheet (join settings) */

.spec {
  width: 100%;
  border-top: 1px solid var(--ink);
}

.spec th,
.spec td {
  padding: var(--s3) 0;
  border-bottom: 1px solid var(--rule);
  text-align: left;
  vertical-align: middle;
}

.spec th {
  width: 42%;
  padding-right: var(--s4);
  color: var(--steel);
  font-size: var(--fs-label);
  font-weight: 560;
  font-stretch: 118%;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.spec td {
  color: var(--ink);
  font-family: var(--mono);
  font-size: clamp(1rem, 0.85rem + 0.5vw, 1.25rem);
  font-weight: 320;
}

.spec .unit {
  color: var(--steel);
  font-size: 0.75em;
}

.spec .copy-cell {
  width: 1%;
  padding-left: var(--s3);
  text-align: right;
}

.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  padding: 0.4em 0.65em;
  border: 1px solid var(--rule-hi);
  border-radius: 2px;
  background: transparent;
  color: var(--steel);
  font-family: var(--font);
  font-size: 0.6875rem;
  font-weight: 520;
  font-stretch: 112%;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 160ms var(--ease-out), color 160ms var(--ease-out);
}

.copy-btn:hover {
  border-color: var(--steel);
  color: var(--ink);
}

.copy-btn .led {
  width: 5px;
  height: 5px;
}

.copy-btn.is-done {
  border-color: var(--signal);
  color: var(--ink);
}

.copy-btn.is-done .led {
  background: var(--signal);
  box-shadow: none;
}

.roles {
  margin: var(--s6) 0 0;
  padding: 0;
}

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

.config-title {
  margin-top: var(--s7);
}

.config-note {
  margin: var(--s2) 0 var(--s4);
  font-size: var(--fs-small);
}

.roles > div {
  display: grid;
  grid-template-columns: 9rem minmax(0, 1fr);
  gap: var(--s4);
  padding-block: var(--s3);
  border-bottom: 1px solid var(--rule);
}

.roles dt {
  color: var(--ink);
  font-family: var(--mono);
  font-size: var(--fs-small);
}

.roles dd {
  margin: 0;
  font-size: var(--fs-small);
}

@media (max-width: 520px) {
  .roles > div {
    grid-template-columns: 1fr;
    gap: var(--s1);
  }
}

/* console block */

.console {
  margin: var(--s5) 0;
  overflow: hidden;
  border: 1px solid var(--rule-hi);
  border-radius: 3px;
  background: #08090a;
}

.console-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  padding: var(--s2) var(--s2) var(--s2) var(--s3);
  border-bottom: 1px solid var(--rule);
  background: var(--plate);
}

.console pre,
.prose pre {
  margin: 0;
  padding: var(--s4) var(--s5);
  overflow-x: auto;
  color: var(--ink);
  font-size: 0.875rem;
  line-height: 1.75;
  tab-size: 2;
}

.console pre code,
.prose pre code {
  padding: 0;
  border: 0;
  background: none;
  font-size: inherit;
  white-space: pre;
}

/* link list (resources) */

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

.link-table li {
  display: grid;
  grid-template-columns: minmax(8rem, 0.8fr) minmax(0, 1.2fr);
  gap: var(--s4);
  margin: 0;
  padding-block: var(--s3);
  border-bottom: 1px solid var(--rule);
  font-size: var(--fs-small);
}

.link-table .link-name {
  color: var(--steel);
}

.link-table a {
  overflow-wrap: anywhere;
}

@media (max-width: 520px) {
  .link-table li {
    grid-template-columns: 1fr;
    gap: 0;
  }
}

/* --------------------------------------------------------------------------
   Prose (articles and long text)
   -------------------------------------------------------------------------- */

.prose {
  max-width: var(--measure);
}

.prose > * + * {
  margin-top: 0;
}

.prose h2 {
  margin: var(--s7) 0 var(--s4);
  font-size: clamp(1.5rem, 1.15rem + 1.2vw, 2.125rem);
  scroll-margin-top: var(--s6);
}

.prose h3 {
  margin: var(--s6) 0 var(--s3);
  scroll-margin-top: var(--s6);
}

.prose h4 {
  margin: var(--s5) 0 var(--s2);
}

.prose > h2:first-child,
.prose > h3:first-child {
  margin-top: 0;
}

.prose img {
  width: 100%;
  margin: var(--s5) 0;
  border: 1px solid var(--rule);
  border-radius: 3px;
}

.prose pre {
  margin: var(--s5) 0;
  border: 1px solid var(--rule-hi);
  border-radius: 3px;
  background: #08090a;
}

.prose blockquote {
  margin: var(--s5) 0;
  padding: var(--s3) 0 var(--s3) var(--s5);
  border-left: 1px solid var(--steel);
  color: var(--ink);
}

.prose blockquote p:last-child {
  margin: 0;
}

.prose table {
  margin: var(--s5) 0;
  font-size: var(--fs-small);
}

.prose th,
.prose td {
  padding: var(--s2) var(--s3) var(--s2) 0;
  border-bottom: 1px solid var(--rule);
  text-align: left;
}

.prose th {
  color: var(--steel);
  font-weight: 560;
}

.prose em {
  color: var(--ink);
}

.prose > p:first-child em:only-child {
  font-style: normal;
}

/* --------------------------------------------------------------------------
   Articles
   -------------------------------------------------------------------------- */

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

.article-list > li {
  margin: 0;
  border-bottom: 1px solid var(--rule);
}

.article-row {
  display: grid;
  grid-template-columns: 9rem minmax(0, 1fr) auto;
  gap: var(--s3) var(--s6);
  align-items: baseline;
  padding-block: var(--s5);
  color: inherit;
  text-decoration: none;
}

.article-row time {
  color: var(--steel);
  font-family: var(--mono);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
}

.article-row h2 {
  font-size: clamp(1.375rem, 1.05rem + 1.2vw, 2rem);
  font-weight: 260;
  transition: color 160ms var(--ease-out);
}

.article-row p {
  grid-column: 2;
  max-width: 62ch;
  margin: var(--s2) 0 0;
  color: var(--ink-2);
  font-size: var(--fs-small);
}

.article-row .icon {
  grid-column: 3;
  grid-row: 1;
  width: 1.25rem;
  height: 1.25rem;
  color: var(--steel);
  transition: transform 240ms var(--ease-out), color 160ms var(--ease-out);
}

.article-row:hover .icon,
.article-row:focus-visible .icon {
  color: var(--ink);
  transform: translateX(4px);
}

@media (max-width: 720px) {
  .article-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .article-row time {
    grid-column: 1 / -1;
  }

  .article-row h2,
  .article-row p {
    grid-column: 1;
  }

  .article-row .icon {
    grid-column: 2;
    grid-row: 2;
  }
}

.article-head {
  padding-block: clamp(var(--s6), 5vw, var(--s8)) var(--s6);
}

.crumbs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
  margin: 0 0 var(--s6);
  padding: 0;
  list-style: none;
  color: var(--steel);
  font-size: 0.8125rem;
}

.crumbs li + li {
  margin: 0;
}

.crumbs li + li::before {
  content: "/";
  margin-right: var(--s2);
  color: var(--rule-hi);
}

.crumbs a {
  color: var(--steel);
  text-decoration: none;
}

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

.article-head h1 {
  max-width: 20ch;
  font-size: clamp(2rem, 1rem + 3.6vw, 4rem);
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s2) var(--s4);
  margin-top: var(--s5);
  color: var(--steel);
  font-family: var(--mono);
  font-size: 0.75rem;
}

.article-meta span + span::before {
  content: "·";
  margin-right: var(--s4);
  color: var(--rule-hi);
}

.article-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 15rem;
  gap: var(--s8);
  align-items: start;
  padding-top: var(--s6);
  border-top: 1px solid var(--rule);
}

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

.toc {
  position: sticky;
  top: var(--s6);
  order: 2;
  font-size: 0.8125rem;
}

.toc-title {
  margin-bottom: var(--s3);
}

.toc ul {
  margin: 0;
  padding: 0;
  list-style: none;
  border-left: 1px solid var(--rule);
}

.toc ul ul {
  display: none;
}

.toc li + li {
  margin: 0;
}

.toc a {
  display: block;
  padding: var(--s1) 0 var(--s1) var(--s4);
  margin-left: -1px;
  border-left: 1px solid transparent;
  color: var(--steel);
  line-height: 1.4;
  text-decoration: none;
}

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

.toc a.is-active {
  border-left-color: var(--signal);
  color: var(--ink);
}

@media (max-width: 1080px) {
  .article-body {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--s6);
  }

  .toc {
    position: static;
    order: 0;
    padding-bottom: var(--s5);
    border-bottom: 1px solid var(--rule);
  }
}

.article-foot {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s4);
  max-width: var(--measure);
  margin-top: var(--s8);
  padding-top: var(--s5);
  border-top: 1px solid var(--rule);
}

.article-foot a {
  display: flex;
  flex-direction: column;
  gap: var(--s1);
  color: var(--ink);
  text-decoration: none;
}

.article-foot a span {
  color: var(--steel);
  font-size: 0.75rem;
  font-stretch: 112%;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.article-foot a:hover {
  text-decoration: underline;
  text-decoration-color: var(--signal);
}

.article-foot .next {
  grid-column: 2;
  text-align: right;
}

@media (max-width: 600px) {
  .article-foot {
    grid-template-columns: 1fr;
  }

  .article-foot .next {
    grid-column: 1;
    text-align: left;
  }
}

/* --------------------------------------------------------------------------
   Gallery
   -------------------------------------------------------------------------- */

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(11rem, 45%), 1fr));
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.gallery-grid li + li {
  margin: 0;
}

.gallery-item {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 2px;
  background: var(--plate);
  cursor: zoom-in;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(1) brightness(0.88);
  transition: transform 700ms var(--ease-out), filter 400ms var(--ease-out);
}

.gallery-item .tape {
  position: absolute;
  bottom: 6px;
  left: 6px;
  padding: 0.25em 0.5em;
  letter-spacing: 0.08em;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 200ms var(--ease-out), transform 260ms var(--ease-out);
}

.gallery-item:hover img,
.gallery-item:focus-visible img {
  filter: none;
  transform: scale(1.04);
}

.gallery-item:hover .tape,
.gallery-item:focus-visible .tape {
  opacity: 1;
  transform: none;
}

.gallery-item:focus-visible {
  outline-offset: -2px;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  padding: var(--s3);
  background: rgb(6 7 8 / 0.97);
}

.lightbox[hidden] {
  display: none;
}

.lightbox-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  padding: var(--s2);
}

.lightbox-count {
  color: var(--steel);
  font-family: var(--mono);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
}

.lightbox-stage {
  position: relative;
  min-height: 0;
}

/* pinned to the stage so a large image always fits the viewport */
.lightbox-stage img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.lightbox-controls {
  display: flex;
  justify-content: center;
  gap: var(--s3);
  padding: var(--s3);
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border: 1px solid var(--rule-hi);
  border-radius: 2px;
  background: var(--plate);
  color: var(--ink);
  cursor: pointer;
  transition: border-color 160ms var(--ease-out);
}

.icon-btn:hover {
  border-color: var(--steel);
}

.icon-btn .icon {
  width: 1.2rem;
  height: 1.2rem;
}

.lightbox-original {
  color: var(--steel);
  font-size: 0.8125rem;
}

/* --------------------------------------------------------------------------
   Motion: relay and tape-feed. Content is visible without either.
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: no-preference) {
  .js .hero .module .tape {
    animation: tape-feed 620ms var(--ease-out) both;
    animation-delay: calc(240ms + var(--i, 0) * 110ms);
  }

  .js .hero h1 {
    animation: settle 900ms var(--ease-out) both;
  }

  .js .hero .hero-lede {
    animation: settle 900ms var(--ease-out) 120ms both;
  }
}

@keyframes tape-feed {
  from {
    clip-path: inset(0 100% 0 0);
  }

  to {
    clip-path: inset(0 0 0 0);
  }
}

@keyframes settle {
  from {
    opacity: 0.3;
    filter: blur(5px);
    transform: translateY(0.08em);
  }

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

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

  .packet {
    display: none;
  }
}
