:root {
  color-scheme: light;
  --background: #ffffff;
  --soft: #f7f8fa;
  --border: #dfe3e6;
  --text: #17212b;
  --muted: #65717c;
  --accent: #2563a6;
  --accent-soft: #edf4fb;
  --danger: #b7443e;
  --danger-soft: #fff1f0;
  --sans: Arial, Helvetica, sans-serif;
  --mono: Consolas, "Liberation Mono", monospace;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

button {
  font: inherit;
}

main {
  width: min(1240px, calc(100% - 56px));
  margin: 0 auto;
}

.hero {
  padding: 68px 0 64px;
}

.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

h1 {
  margin: 0 0 22px;
  font-size: clamp(42px, 4.5vw, 58px);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -.035em;
}

.intro {
  max-width: 980px;
  margin: 0;
  color: #4f5b65;
  font-size: 18px;
  line-height: 1.6;
}

.demo {
  border-top: 1px solid var(--border);
  padding: 32px 0 72px;
}

.demo-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

h2 {
  margin: 6px 0 0;
  font-size: 27px;
  font-weight: 600;
  letter-spacing: -.02em;
}

.demo-controls {
  display: flex;
  gap: 8px;
}

.scenario,
.run-button {
  min-height: 40px;
  border: 1px solid #cbd1d6;
  border-radius: 4px;
  padding: 0 14px;
  background: #fff;
  color: #46515b;
  cursor: pointer;
  font-size: 13px;
}

.scenario:hover,
.scenario.active {
  border-color: #7f8992;
  background: var(--soft);
  color: var(--text);
}

.run-button {
  min-width: 82px;
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}

.run-button:hover {
  background: #1d538d;
}

.run-button:disabled {
  cursor: wait;
  opacity: .6;
}

.flow {
  display: grid;
  grid-template-columns: 165px minmax(70px, 1fr) 260px minmax(70px, 1fr) 230px;
  align-items: center;
  min-height: 340px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 32px;
  background: var(--soft);
  overflow: hidden;
}

.endpoint,
.parser {
  position: relative;
  z-index: 2;
}

.endpoint {
  min-height: 220px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: #fff;
}

.icon-box {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  margin-bottom: 30px;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--accent);
}

.icon-box svg {
  width: 36px;
  height: 36px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.node-label {
  margin: 0 0 7px;
  color: var(--muted);
  font-size: 12px;
}

.endpoint > strong {
  display: block;
  margin-bottom: 7px;
  font-size: 15px;
}

.endpoint > span,
.endpoint > p:last-child {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.route {
  position: relative;
  height: 90px;
}

.route-line {
  position: absolute;
  top: 41px;
  left: 0;
  right: 0;
  height: 1px;
  background: #b7c0c7;
}

.route-line::after {
  content: "";
  position: absolute;
  top: -4px;
  right: 0;
  width: 8px;
  height: 8px;
  border-top: 1px solid #8f9aa2;
  border-right: 1px solid #8f9aa2;
  transform: rotate(45deg);
}

.route small {
  position: absolute;
  top: 55px;
  left: 50%;
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
  transform: translateX(-50%);
}

.packet {
  position: absolute;
  z-index: 3;
  top: 23px;
  left: -15px;
  display: flex;
  border: 1px solid #aeb8c0;
  border-radius: 3px;
  background: #fff;
  opacity: 0;
}

.packet span,
.packet i {
  display: grid;
  min-width: 26px;
  height: 35px;
  place-items: center;
  border-right: 1px solid var(--border);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 10px;
  font-style: normal;
}

.packet i {
  min-width: 29px;
  border: 0;
  color: var(--muted);
}

.flow.running .packet {
  opacity: 1;
  transform: translateX(calc(100% - 65px));
  transition: transform 900ms ease-in-out, opacity 120ms ease;
}

.parser {
  min-height: 270px;
  border: 1px solid #b8c1c8;
  border-radius: 5px;
  background: #fff;
}

.parser-title {
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 17px;
  border-bottom: 1px solid var(--border);
}

.parser-title span {
  font-size: 15px;
  font-weight: 600;
}

.parser-title i,
.output-top > span {
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 4px 7px;
  color: var(--muted);
  font-size: 10px;
  font-style: normal;
}

.parser ol {
  list-style: none;
  margin: 0;
  padding: 9px 17px;
}

.parser li {
  min-height: 48px;
  display: grid;
  grid-template-columns: 25px 1fr 12px;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid #edf0f2;
  color: var(--muted);
}

.parser li:last-child {
  border-bottom: 0;
}

.parser li > span {
  font-family: var(--mono);
  font-size: 9px;
}

.parser li strong {
  font-size: 12px;
  font-weight: 400;
}

.parser li i {
  width: 9px;
  height: 9px;
  border: 1px solid #aeb7be;
  border-radius: 50%;
}

.parser li.active {
  color: var(--text);
}

.parser li.active i {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.parser li.done {
  color: #44515b;
}

.parser li.done i {
  border-color: var(--accent);
  background: var(--accent);
}

.parser li.failed {
  color: var(--danger);
}

.parser li.failed i {
  border-color: var(--danger);
  background: var(--danger);
  box-shadow: 0 0 0 3px var(--danger-soft);
}

.parser.accepted {
  border-color: #6c99c6;
}

.parser.rejected {
  border-color: #d69a96;
}

.data-pulse {
  position: absolute;
  top: 37px;
  left: 0;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0;
}

.flow.accepted .data-pulse {
  opacity: 1;
  transform: translateX(calc(100% - 9px));
  transition: transform 650ms ease-out, opacity 120ms ease;
}

.output {
  padding: 19px;
}

.output-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 22px;
}

.output-top > span.good {
  border-color: #9db9d4;
  background: var(--accent-soft);
  color: var(--accent);
}

.output-top > span.bad {
  border-color: #e2b3b0;
  background: var(--danger-soft);
  color: var(--danger);
}

.output > strong {
  display: block;
  margin-bottom: 14px;
  font-family: var(--mono);
  font-size: 12px;
}

.output dl {
  margin: 0;
}

.output dl div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid #edf0f2;
}

.output dt {
  color: var(--muted);
  font-size: 11px;
}

.output dd {
  margin: 0;
  font-family: var(--mono);
  font-size: 11px;
}

.output > p:last-child {
  min-height: 32px;
  margin: 16px 0 0;
}

.output.rejected {
  border-color: #d69a96;
}

.output.rejected dl,
.output.rejected > strong {
  opacity: .3;
}

.flow-caption {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 24px;
  color: var(--muted);
  font-size: 12px;
}

.flow-caption p {
  margin: 0;
}

.reason {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 50px;
  border-top: 1px solid var(--border);
  padding: 38px 0 72px;
}

.reason > p {
  max-width: 500px;
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.65;
}

.technical {
  border-top: 1px solid var(--border);
  padding: 38px 0 72px;
}

.technical-heading {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 50px;
  margin-bottom: 28px;
}

.technical-heading > p {
  max-width: 520px;
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.65;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 5px;
}

table {
  width: 100%;
  min-width: 660px;
  border-collapse: collapse;
  background: #fff;
  text-align: left;
}

th,
td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  line-height: 1.45;
}

th {
  background: var(--soft);
  color: #43505a;
  font-weight: 600;
}

th:first-child,
td:first-child {
  width: 22%;
  font-weight: 600;
}

th:nth-child(2),
td:nth-child(2) {
  width: 18%;
  white-space: nowrap;
}

tbody tr:last-child td {
  border-bottom: 0;
}

td code {
  font-family: var(--mono);
  font-size: 12px;
}

.technical-note {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.source-code {
  border-top: 1px solid var(--border);
  padding: 38px 0 72px;
}

.source-heading {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 50px;
  margin-bottom: 28px;
}

.source-heading > p {
  max-width: 520px;
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.65;
}

.source-shell {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 5px;
}

.source-tabs {
  display: flex;
  gap: 2px;
  padding: 6px;
  border-bottom: 1px solid var(--border);
  background: var(--soft);
}

.source-tab {
  min-height: 36px;
  border: 0;
  border-radius: 3px;
  padding: 0 13px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 12px;
}

.source-tab:hover,
.source-tab.active {
  background: #fff;
  color: var(--text);
}

.source-tab.active {
  box-shadow: inset 0 0 0 1px var(--border);
}

.source-view {
  height: 620px;
  margin: 0;
  padding: 20px;
  overflow: auto;
  background: #fbfcfd;
  color: #27333c;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.55;
  tab-size: 4;
}

.source-view code {
  display: block;
  min-width: max-content;
}

.source-view code[hidden] {
  display: none;
}

.tok-comment {
  color: #5b785d;
}

.tok-keyword {
  color: #7a3e9d;
  font-weight: 600;
}

.tok-type {
  color: #1e6091;
}

.tok-string {
  color: #9a4f13;
}

.tok-number {
  color: #087f76;
}

.tok-preprocessor {
  color: #8a3b57;
}

@media (max-width: 960px) {
  .flow {
    grid-template-columns: 145px minmax(55px, 1fr) 235px;
    row-gap: 24px;
  }

  .route-out {
    display: none;
  }

  .sender {
    grid-row: 1 / 3;
  }

  .route-in {
    grid-row: 1 / 3;
  }

  .parser {
    grid-column: 3;
    grid-row: 1;
  }

  .output {
    grid-column: 3;
    grid-row: 2;
  }
}

@media (max-width: 700px) {
  main {
    width: min(100% - 28px, 1240px);
  }

  .hero {
    padding: 54px 0 56px;
  }

  h1 {
    font-size: 43px;
  }

  .intro {
    font-size: 16px;
  }

  .demo-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .demo-controls {
    width: 100%;
  }

  .scenario {
    flex: 1;
    padding-inline: 8px;
  }

  .flow {
    grid-template-columns: 1fr;
    padding: 18px;
    gap: 0;
  }

  .sender,
  .parser,
  .output,
  .route-in {
    grid-column: 1;
    grid-row: auto;
  }

  .endpoint {
    min-height: 0;
  }

  .sender {
    display: grid;
    grid-template-columns: 50px 1fr;
    column-gap: 14px;
    align-items: center;
  }

  .sender .icon-box {
    grid-row: 1 / 4;
    width: 50px;
    height: 50px;
    margin: 0;
  }

  .sender .node-label,
  .sender strong,
  .sender > span {
    grid-column: 2;
  }

  .sender .node-label {
    margin-bottom: -3px;
  }

  .sender strong {
    margin: 0;
  }

  .route-in {
    height: 88px;
  }

  .route-line {
    top: 0;
    bottom: 0;
    left: 50%;
    right: auto;
    width: 1px;
    height: auto;
  }

  .route-line::after {
    top: auto;
    right: -4px;
    bottom: 0;
    transform: rotate(135deg);
  }

  .route small {
    top: 36px;
    left: calc(50% + 20px);
    transform: none;
  }

  .packet {
    top: 23px;
    left: calc(50% - 56px);
  }

  .flow.running .packet {
    transform: translateY(33px);
  }

  .output {
    margin-top: 18px;
  }

  .flow-caption {
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    padding: 14px 0;
  }

  .reason {
    grid-template-columns: 1fr;
    gap: 22px;
  }

  .technical-heading {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .source-heading {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .source-view {
    height: 480px;
    padding: 15px;
    font-size: 11px;
  }

}

@media (max-width: 440px) {
  h1 {
    font-size: 38px;
  }

  .demo-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .run-button {
    grid-column: 1 / -1;
  }
}

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