@font-face {
  font-family: Inter;
  src: url("./assets/fonts/InterVariable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: BerkeleyMono;
  src: url("./assets/fonts/BerkeleyMonoVariable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #fff;
  --bg-soft: #f7f7f2;
  --fg: #111;
  --fg-soft: #575750;
  --border: #111;
  --yellow: #feca00;
  --red: #ff3240;
  --gray: #d8d8d1;
  --mono: BerkeleyMono, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --line: 20px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131316;
    --bg-soft: #1b1b1f;
    --fg: #f7f7f2;
    --fg-soft: #aaa99f;
    --border: #f7f7f2;
    --gray: #313138;
  }
}

* {
  box-sizing: border-box;
}

::selection {
  background: #ffff00;
  color: #000;
}

html {
  background: var(--bg);
  color: var(--fg);
  font: 12px / var(--line) var(--mono);
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 82% 12%, color-mix(in srgb, var(--yellow) 16%, transparent), transparent 280px),
    linear-gradient(90deg, transparent 0 calc(50% - .5px), color-mix(in srgb, var(--fg) 8%, transparent) calc(50% - .5px) calc(50% + .5px), transparent calc(50% + .5px)),
    var(--bg);
}

body::after {
  position: fixed;
  inset: 0;
  pointer-events: none;
  content: "";
  opacity: .08;
  background-image:
    repeating-linear-gradient(0deg, currentColor 0 1px, transparent 1px 7px),
    repeating-linear-gradient(90deg, currentColor 0 1px, transparent 1px 11px);
  mask-image: linear-gradient(to bottom, transparent, #000 12%, #000 88%, transparent);
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.shell {
  min-height: 100vh;
  padding: 12px 40px 0;
  background: var(--bg-soft);
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  line-height: 18px;
  text-transform: uppercase;
}

.brand {
  text-decoration: none;
}

.cursor {
  animation: flash 1s infinite;
}

@keyframes flash {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

.topbar nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 12px;
  text-align: right;
}

.layout {
  display: flex;
  gap: 20px;
  width: fit-content;
  margin: 80px auto 0;
}

.copy {
  display: flex;
  flex-direction: column;
  gap: 24px;
  max-width: 500px;
  padding: 40px 0;
}

.copy > * {
  margin: 0;
}

.mark {
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  background:
    linear-gradient(45deg, transparent 44%, var(--fg) 45% 55%, transparent 56%),
    linear-gradient(-45deg, transparent 44%, var(--fg) 45% 55%, transparent 56%);
}

h1,
h2 {
  font: 700 12px / 20px var(--mono);
}

h1::before {
  content: "# ";
  color: var(--fg-soft);
}

h2 {
  margin-top: 14px;
  text-transform: uppercase;
}

h2::before {
  content: "## ";
  color: var(--fg-soft);
}

ul {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  margin: 0;
  list-style: none;
}

li {
  display: grid;
  grid-template-columns: 24px auto;
}

li::before {
  content: "*";
  grid-column: 1;
  width: 20px;
  text-align: center;
  font-size: 16px;
}

footer {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.diagram {
  display: block;
  width: 620px;
  margin-top: 0;
}

.diagram-stage {
  position: relative;
  min-height: 2440px;
  overflow: hidden;
}

.reticle {
  position: absolute;
  top: 160px;
  left: 50%;
  width: 318px;
  height: 318px;
  margin-left: -159px;
  border-radius: 100%;
  color: var(--fg);
}

.reticle svg {
  width: 100%;
  height: 100%;
  animation: drift 20s linear infinite;
}

@keyframes drift {
  to { rotate: 360deg; }
}

.tag {
  z-index: 2;
  width: fit-content;
  padding: 0 10px;
  border-radius: 4px;
  background: var(--fg);
  color: var(--bg);
  font-size: 10px;
  font-weight: 700;
  line-height: 14px;
  text-align: center;
  white-space: nowrap;
}

.tag-signal {
  position: absolute;
  top: 580px;
  right: 80px;
}

.spine {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.top-spine {
  position: absolute;
  top: 640px;
  left: 50%;
  translate: -50% 0;
}

.dot {
  width: 10px;
  height: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.dot.slash {
  rotate: -45deg;
  border-bottom: 1px solid var(--border);
}

.line {
  width: 1px;
  border-right: 1px dashed var(--border);
}

.line.tall {
  height: 80px;
}

.capture-box {
  position: absolute;
  top: 790px;
  left: 50%;
  width: 420px;
  min-height: 420px;
  translate: -50% 0;
  padding: 6px;
  border: 1px solid var(--border);
  background: var(--gray);
}

.corner {
  position: absolute;
  width: 14px;
  height: 1px;
  border-top: 1px solid var(--border);
}

.c1 { top: -6px; left: -3px; rotate: -45deg; }
.c2 { top: -6px; right: -13px; rotate: -45deg; }
.c3 { right: -13px; bottom: 4px; rotate: -45deg; }
.c4 { top: -11px; right: -11px; height: 20px; width: 1px; border-top: 0; border-right: 1px dashed var(--border); }

.tag-capture {
  position: absolute;
  top: -64px;
  left: -40px;
}

.screen {
  position: relative;
  min-height: 406px;
  overflow: hidden;
  border: 1px solid var(--border);
  background:
    linear-gradient(180deg, transparent 0 48%, color-mix(in srgb, var(--fg) 10%, transparent) 48% 52%, transparent 52%),
    repeating-linear-gradient(0deg, color-mix(in srgb, var(--fg) 10%, transparent) 0 1px, transparent 1px 20px),
    var(--bg);
}

.scanline {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--yellow) 22%, transparent), transparent);
  animation: scan 5s ease-in-out infinite;
}

@keyframes scan {
  0%, 100% { translate: 0 -55%; }
  50% { translate: 0 55%; }
}

.event {
  position: absolute;
  padding: 2px 6px;
  border: 1px solid var(--border);
  background: var(--bg);
}

.event.human { top: 66px; left: 42px; }
.event.agent { top: 150px; right: 44px; }
.event.tool { top: 232px; left: 74px; }
.event.proof { right: 56px; bottom: 54px; background: #ffff00; color: #000; }

.branch-grid {
  position: absolute;
  top: 1250px;
  left: 50%;
  display: flex;
  justify-content: center;
  gap: 24px;
  translate: -50% 0;
}

.branch {
  position: relative;
  width: 54px;
  border-right: 1px dashed var(--border);
}

.branch::after {
  position: absolute;
  bottom: -38px;
  left: 30px;
  width: 48px;
  height: 48px;
  content: "";
  border: 1px dashed var(--border);
  border-radius: 100px;
}

.branch.short { height: 80px; }
.branch.medium { height: 160px; }
.branch.active { height: 320px; border-right-style: solid; }

.tag-proof {
  position: absolute;
  top: -60px;
  left: -160px;
  padding: 4px 10px;
  font-size: 10px;
  line-height: 14px;
}

.api-stack {
  position: absolute;
  top: 1588px;
  left: calc(50% + 27px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  translate: -50% 0;
}

.rail {
  width: 1px;
  border-right: 1px dashed var(--border);
}

.rail.bridge { height: 86px; }
.rail.long { height: 170px; }

.node.big {
  position: relative;
  width: 10px;
  height: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-soft);
}

.tag-api,
.tag-evidence,
.tag-record {
  position: absolute;
  padding: 4px 10px;
  font-size: 10px;
  line-height: 14px;
}

.tag-api {
  top: -21px;
  right: 28px;
}

.tag-evidence {
  top: -21px;
  left: 28px;
}

.record-arrow {
  position: relative;
  width: 1px;
  height: 132px;
  margin-top: 2px;
  border-right: 1px dashed var(--border);
}

.record-arrow::after {
  position: absolute;
  bottom: -1px;
  left: -4px;
  width: 8px;
  height: 8px;
  content: "";
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  rotate: 45deg;
  background: var(--bg-soft);
}

.tag-record {
  position: relative;
  margin-top: 10px;
}

.narrow {
  display: none;
}

@media (max-width: 1080px) {
  .diagram {
    display: none;
  }

  .layout {
    width: auto;
    margin-top: 80px;
  }
}

@media (max-width: 720px) {
  .shell {
    padding: 12px 18px 0;
  }

  .layout {
    margin-top: 48px;
  }

  .topbar nav {
    display: block;
  }

  .topbar nav > * {
    margin-left: 4px;
  }

  .wide {
    display: none;
  }

  .narrow {
    display: inline;
  }
}
