@font-face {
  font-family: "Inter Tight";
  src: url("fonts/of-inter-tight-800.woff2") format("woff2");
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Inter";
  src: url("fonts/of-inter-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --field: #151513;
  --lime: #faff69;
  --grey: #414141;
  --panel: #1c1c19;
  --panel-2: #242420;
  --ink: #f4f4ef;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--field);
  color: var(--ink);
  font: 400 16px/1.5 "Inter", system-ui, sans-serif;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.page {
  min-height: 100vh;
  min-height: 100dvh;
  padding: 44px 52px 26px;
  display: flex;
  flex-direction: column;
}

/* ---------- headline ---------- */

.head h1 {
  margin: 0;
  max-width: 30ch;
  font-family: "Inter Tight", "Inter", system-ui, sans-serif;
  font-weight: 800;
  font-size: 34px;
  line-height: 1.14;
  letter-spacing: -0.03em;
  color: var(--ink);
  text-wrap: balance;
}

.head h1 span {
  color: var(--lime);
}

/* ---------- the stage ---------- */

.stage {
  flex: 1;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-rows: 1fr;
  align-items: center;
  margin-top: 8px;
  min-height: 360px;
}

.end {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 238px;
  z-index: 2;
}

.end--left {
  grid-column: 1;
  justify-self: start;
}

.end--right {
  grid-column: 3;
  justify-self: end;
}

/* ---------- boxes ---------- */

.box {
  position: relative;
  appearance: none;
  -webkit-appearance: none;
  -webkit-tap-highlight-color: transparent;
  margin: 0;
  width: 100%;
  height: 104px;
  padding: 15px 17px;
  background: var(--panel);
  border: 1px solid var(--panel-2);
  border-radius: 1px;
  color: var(--ink);
  font: inherit;
  text-align: left;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  transition: border-color 0.18s ease, background-color 0.18s ease;
}

.box:hover {
  border-color: var(--grey);
}

.box:focus-visible {
  outline: 1px solid var(--lime);
  outline-offset: 3px;
}

.end.is-open .box {
  border-color: var(--grey);
  background: var(--panel-2);
}

.box-head {
  display: flex;
  align-items: center;
  gap: 9px;
}

.dot {
  display: block;
  width: 5px;
  height: 5px;
  background: var(--lime);
}

.box-label {
  font: 400 13px/1 "Inter", system-ui, sans-serif;
  letter-spacing: 0.02em;
  color: rgba(244, 244, 239, 0.78);
  transition: color 0.18s ease;
}

.end.is-open .box-label {
  color: var(--ink);
}

.box::before,
.box::after {
  content: "";
  position: absolute;
  top: 50%;
  pointer-events: none;
}

.box::before {
  width: 26px;
  height: 1px;
  background: var(--grey);
}

.box::after {
  width: 3px;
  height: 3px;
  margin-top: -1.5px;
  background: var(--lime);
  opacity: 0.85;
}

.end--left .box::before {
  right: 0;
}

.end--left .box::after {
  right: 26px;
}

.end--right .box::before {
  left: 0;
}

.end--right .box::after {
  left: 26px;
}

.box-foot {
  display: flex;
  justify-content: flex-end;
  align-items: flex-end;
  gap: 5px;
}

.box-foot i {
  display: block;
  width: 16px;
  height: 1px;
  background: var(--grey);
}

.box-foot i:first-child {
  width: 24px;
  background: var(--lime);
  opacity: 0.75;
}

/* ---------- the tunnel ---------- */

.tunnel {
  position: relative;
  grid-column: 2;
  align-self: stretch;
  height: 100%;
  min-height: 320px;
  display: flex;
  align-items: center;
  outline: none;
}

.track {
  position: relative;
  width: 100%;
  height: 1px;
  background: var(--grey);
}

.flow {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  margin-top: -0.5px;
  background: rgba(250, 255, 105, 0.22);
  opacity: 0;
  transition: opacity 0.22s ease;
  pointer-events: none;
}

.packets {
  position: absolute;
  inset: 0;
}

.packet {
  position: absolute;
  left: 0;
  top: 50%;
  width: 3px;
  height: 3px;
  margin-top: -1.5px;
  background: var(--lime);
  box-shadow: 0 0 7px rgba(250, 255, 105, 0.5);
  will-change: transform;
  pointer-events: none;
}

.ruler {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(50% + 2px);
  height: 6px;
  background: repeating-linear-gradient(
    90deg,
    rgba(65, 65, 65, 0.8) 0 1px,
    transparent 1px 26px
  );
  pointer-events: none;
}

.latency {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) translateY(-34px);
  padding: 5px 8px;
  background: var(--panel);
  border: 1px solid var(--panel-2);
  font: 400 11px/1 var(--mono);
  letter-spacing: 0.06em;
  color: var(--lime);
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.latency::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 100%;
  width: 1px;
  height: 21px;
  background: var(--grey);
}

.tunnel:hover .latency,
.tunnel:focus-visible .latency {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%) translateY(-34px);
}

.tunnel:hover .flow,
.tunnel:focus-visible .flow {
  opacity: 1;
}

/* ---------- spec panels ---------- */

.panel {
  position: absolute;
  top: calc(100% + 16px);
  left: 0;
  width: 302px;
  z-index: 3;
  padding: 12px;
  background: var(--panel);
  border: 1px solid var(--panel-2);
  border-radius: 1px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-5px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
}

.panel::before {
  content: "";
  position: absolute;
  top: -17px;
  left: 17px;
  width: 1px;
  height: 16px;
  background: var(--grey);
}

.end.is-open .panel {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.end--right .panel {
  left: auto;
  right: 0;
  width: 322px;
}

.end--right .panel::before {
  left: auto;
  right: 17px;
}

.tabs {
  display: flex;
  gap: 3px;
}

.tab {
  appearance: none;
  -webkit-appearance: none;
  flex: 1 1 auto;
  min-width: 0;
  padding: 7px 6px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 1px;
  color: rgba(244, 244, 239, 0.6);
  font: 400 11px/1.1 "Inter", system-ui, sans-serif;
  letter-spacing: 0.015em;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.15s ease, background-color 0.15s ease;
}

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

.tab[aria-pressed="true"] {
  background: var(--lime);
  color: var(--field);
}

.tab:focus-visible {
  outline: 1px solid var(--lime);
  outline-offset: 2px;
}

.spec {
  margin: 11px 0 0;
  padding-top: 11px;
  border-top: 1px solid var(--panel-2);
  font: 400 11px/1.5 var(--mono);
  letter-spacing: 0.02em;
  color: rgba(244, 244, 239, 0.62);
}

.cmd {
  margin: 0;
  font: 400 11px/1.5 var(--mono);
  letter-spacing: 0.01em;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.port {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 11px 0 0;
  padding-top: 10px;
  border-top: 1px solid var(--panel-2);
  font: 400 11px/1 var(--mono);
}

.port span:first-child {
  color: rgba(244, 244, 239, 0.45);
  letter-spacing: 0.08em;
}

.port-val {
  color: var(--lime);
  letter-spacing: 0.04em;
}

/* ---------- foot ---------- */

.foot {
  display: flex;
  justify-content: flex-end;
  padding-top: 20px;
  border-top: 1px solid var(--panel-2);
}

.foot a {
  font: 400 13px/1 "Inter", system-ui, sans-serif;
  letter-spacing: 0.01em;
  color: rgba(244, 244, 239, 0.6);
  text-decoration: none;
  transition: color 0.18s ease;
}

.foot a:hover,
.foot a:focus-visible {
  color: var(--lime);
}

.foot a:focus-visible {
  outline: 1px solid var(--lime);
  outline-offset: 4px;
}

/* ---------- mid widths ---------- */

@media (max-width: 1040px) {
  .page {
    padding: 36px 34px 22px;
  }

  .head h1 {
    font-size: 30px;
  }

  .end {
    width: 208px;
  }

  .box {
    height: 98px;
    padding: 14px 15px;
  }

  .end--right .panel {
    width: 306px;
  }

  .panel {
    width: 292px;
  }
}

/* ---------- phone: the drawing turns upright ---------- */

@media (max-width: 720px) {
  .page {
    padding: 26px 22px 18px;
  }

  .head h1 {
    font-size: 26px;
    line-height: 1.16;
    letter-spacing: -0.025em;
    max-width: none;
  }

  .stage {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 18px;
    min-height: 0;
    margin-top: 22px;
  }

  .end {
    width: min(300px, 100%);
    flex: 0 0 auto;
  }

  .end--left {
    order: 1;
  }

  .tunnel {
    order: 2;
    width: 100%;
    height: 176px;
    min-height: 176px;
    align-self: auto;
    justify-content: center;
  }

  .end--right {
    order: 3;
  }

  .box {
    height: 86px;
    padding: 13px 15px;
  }

  .end--left .box::before,
  .end--right .box::before {
    right: auto;
    width: 1px;
    height: 22px;
  }

  .end--left .box::before {
    top: auto;
    bottom: 0;
    left: 50%;
  }

  .end--right .box::before {
    top: 0;
    left: 50%;
  }

  .end--left .box::after,
  .end--right .box::after {
    right: auto;
    left: 50%;
    margin: 0 0 0 -1.5px;
  }

  .end--left .box::after {
    top: auto;
    bottom: 22px;
  }

  .end--right .box::after {
    top: 22px;
  }

  .track {
    width: 1px;
    height: 100%;
    background: var(--grey);
  }

  .flow {
    left: 50%;
    right: auto;
    top: 0;
    width: 1px;
    height: 100%;
    margin: 0 0 0 -0.5px;
  }

  .packet {
    left: 50%;
    top: 0;
    margin: 0 0 0 -1.5px;
  }

  .ruler {
    left: calc(50% + 2px);
    right: auto;
    top: 0;
    bottom: 0;
    width: 6px;
    height: auto;
    background: repeating-linear-gradient(
      180deg,
      var(--panel-2) 0 1px,
      transparent 1px 26px
    );
  }

  .latency {
    left: calc(50% + 12px);
    top: 50%;
    transform: translateY(-50%);
    transition: opacity 0.2s ease;
  }

  .latency::after {
    left: -12px;
    top: 50%;
    width: 12px;
    height: 1px;
  }

  .tunnel:hover .latency,
  .tunnel:focus-visible .latency {
    transform: translateY(-50%);
  }

  .panel {
    position: static;
    width: 100%;
    margin-top: 0;
    padding: 0 12px;
    max-height: 0;
    overflow: hidden;
    border: 1px solid transparent;
    border-radius: 1px;
    opacity: 0;
    visibility: hidden;
    transform: none;
    transition: max-height 0.24s ease, opacity 0.2s ease, padding 0.2s ease,
      margin 0.2s ease, border-color 0.2s ease;
  }

  .end--right .panel {
    width: 100%;
  }

  .panel::before {
    display: none;
  }

  .end.is-open .panel {
    max-height: 180px;
    margin-top: 10px;
    padding: 12px;
    border-color: var(--panel-2);
    opacity: 1;
    visibility: visible;
  }

  .foot {
    padding-top: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .packet,
  .flow,
  .latency,
  .panel,
  .box,
  .tab,
  .box-label {
    transition-duration: 0.01ms;
  }
}
