:root {
  --blue: #2d8cff;
  --blue-pressed: #1f6fcc;
  --ink: #1a1a1a;
  --surface-dark: #2d2d2d;
  --surface-raised: #3a3a3a;
  --paper: #ffffff;
  --wash: #f5f5f5;
  --muted: #626262;
  --line: #d8d8d8;
  --danger: #e02828;
  --shadow: 0 12px 24px rgb(0 0 0 / 18%);
  color-scheme: light;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 17px;
  font-weight: 400;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

a {
  color: var(--blue-pressed);
  text-underline-offset: 0.18em;
  text-decoration-thickness: 0.08em;
}

a:hover {
  text-decoration-thickness: 0.14em;
}

a:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
}

h1,
h2,
h3,
p,
ol,
ul,
dl,
dd {
  margin-top: 0;
}

h1,
h2,
h3 {
  text-wrap: balance;
}

h1 {
  margin-bottom: 16px;
  max-width: 18ch;
  font-size: clamp(32px, 4.7vw, 56px);
  font-weight: 700;
  line-height: 1.03;
  letter-spacing: -0.035em;
}

h2 {
  margin-bottom: 20px;
  font-size: clamp(23px, 2.4vw, 29px);
  font-weight: 700;
  line-height: 1.16;
  letter-spacing: -0.018em;
}

h3 {
  margin-bottom: 8px;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.28;
}

p,
li,
dd,
dt,
summary,
.page-row,
.page-footer a {
  font-size: 17px;
}

.u-mono,
.u-kicker,
.u-status,
.page-wordmark,
.page-index-num,
.page-tile-chip {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}

.u-kicker,
.u-status {
  margin-bottom: 12px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.u-kicker {
  color: var(--blue);
}

.u-status {
  color: var(--muted);
}

.u-primary {
  display: inline-flex;
  min-width: min(100%, 310px);
  min-height: 56px;
  align-items: center;
  justify-content: center;
  margin-top: 18px;
  padding: 13px 22px;
  border: 2px solid var(--blue);
  border-radius: 8px;
  color: var(--paper);
  background: var(--blue);
  box-shadow: none;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  transition: background-color 160ms ease, border-color 160ms ease, transform 120ms ease;
}

.u-primary:hover {
  border-color: var(--blue-pressed);
  background: var(--blue-pressed);
  text-decoration: none;
}

.u-primary:active {
  transform: scale(0.98);
}

.page-skip {
  position: fixed;
  z-index: 100;
  top: 8px;
  left: 8px;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 8px;
  color: var(--paper);
  background: var(--blue-pressed);
  transform: translateY(-140%);
}

.page-skip:focus {
  transform: translateY(0);
}

.page-topbar {
  display: flex;
  min-height: 64px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 16px;
  border-bottom: 1px solid #424242;
  color: var(--paper);
  background: var(--ink);
}

.page-wordmark {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  color: var(--paper);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-decoration: none;
}

.page-layout {
  min-width: 0;
}

.page-main {
  min-width: 0;
}

.page-index-desktop {
  display: none;
}

.page-index-mobile {
  position: relative;
}

.page-index-mobile summary {
  display: flex;
  min-height: 44px;
  align-items: center;
  padding: 7px 12px;
  border: 1px solid #5b5b5b;
  border-radius: 8px;
  color: var(--paper);
  background: var(--surface-dark);
  cursor: pointer;
  font-weight: 600;
  list-style: none;
}

.page-index-mobile summary::-webkit-details-marker {
  display: none;
}

.page-index-mobile[open] {
  position: fixed;
  z-index: 90;
  inset: 8px;
  overflow: auto;
  padding: 10px;
  border-radius: 12px;
  background: var(--surface-dark);
  box-shadow: var(--shadow);
}

.page-index ol {
  margin: 0;
  padding: 0;
  counter-reset: page-index;
  list-style: none;
}

.page-index li {
  counter-increment: page-index;
}

.page-index-mobile ol {
  display: grid;
  gap: 4px;
  padding-top: 8px;
}

.page-index a {
  display: grid;
  min-height: 46px;
  align-items: center;
  grid-template-columns: 34px 1fr;
  padding: 6px 10px;
  border-radius: 8px;
  color: inherit;
  font-size: 16px;
  text-decoration: none;
}

.page-index-mobile a {
  color: var(--paper);
}

.page-index a:hover,
.page-index a[aria-current="page"] {
  color: var(--paper);
  background: var(--blue-pressed);
}

.page-index-num {
  color: inherit;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}

.page-index-num::before {
  content: counter(page-index, decimal-leading-zero);
}

.page-stage {
  position: relative;
  display: grid;
  min-height: min(720px, calc(100svh - 64px));
  align-items: center;
  gap: 36px;
  overflow: hidden;
  padding: clamp(54px, 9vw, 112px) clamp(20px, 6vw, 80px) 96px;
  color: var(--paper);
  background: var(--ink);
}

.page-stage-copy {
  position: relative;
  z-index: 2;
  max-width: 730px;
}

.page-dek {
  max-width: 62ch;
  margin-bottom: 0;
  color: #dedede;
  font-size: clamp(18px, 2vw, 21px);
  line-height: 1.5;
}

.page-route-art {
  position: relative;
  width: min(100%, 470px);
  aspect-ratio: 16 / 9;
  justify-self: end;
  border: 1px solid #444;
  border-radius: 8px;
  background:
    linear-gradient(90deg, transparent 49.6%, #383838 49.6%, #383838 50.4%, transparent 50.4%),
    linear-gradient(0deg, transparent 49.6%, #383838 49.6%, #383838 50.4%, transparent 50.4%),
    var(--surface-dark);
}

.page-route-line {
  position: absolute;
  inset: 18% 10%;
  border-top: 2px solid #838383;
  border-right: 2px solid #838383;
  border-bottom: 2px solid #838383;
  border-radius: 45% 52% 42% 58%;
  transform: rotate(-7deg);
}

.page-route-node {
  position: absolute;
  width: 14px;
  height: 14px;
  border: 3px solid var(--surface-dark);
  border-radius: 50%;
  background: #bcbcbc;
  box-shadow: 0 0 0 2px #777;
}

.page-route-node:nth-of-type(1) { left: 10%; top: 41%; }
.page-route-node:nth-of-type(2) { left: 25%; top: 24%; }
.page-route-node:nth-of-type(3) { left: 43%; top: 44%; }
.page-route-node:nth-of-type(4) { left: 56%; top: 68%; }
.page-route-node:nth-of-type(5) { left: 70%; top: 36%; }
.page-route-node:nth-of-type(6) { left: 83%; top: 59%; }
.page-route-node:nth-of-type(7) { left: 88%; top: 25%; }

.page-route-node.is-active {
  background: var(--blue);
  box-shadow: 0 0 0 3px var(--blue), 0 0 0 7px rgb(45 140 255 / 20%);
  animation: page-node-pulse 1.8s ease-in-out infinite;
}

@keyframes page-node-pulse {
  50% { box-shadow: 0 0 0 3px var(--blue), 0 0 0 13px rgb(45 140 255 / 4%); }
}

.page-content {
  width: min(100% - 32px, 860px);
  margin-inline: auto;
  padding: 58px 0 136px;
}

.page-section,
.page-callout,
.page-sources {
  margin-bottom: 64px;
}

.page-prose p,
.page-callout p,
.page-sources p {
  max-width: 68ch;
}

.page-prose p + p,
.page-callout p + p {
  margin-top: 14px;
}

.page-card-grid {
  display: grid;
  gap: 12px;
}

.page-card {
  min-width: 0;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.page-card p {
  margin-bottom: 0;
  color: #444;
}

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

.page-tile {
  position: relative;
  display: flex;
  aspect-ratio: 16 / 9;
  min-width: 0;
  align-items: flex-end;
  padding: 44px 14px 14px;
  border-radius: 8px;
  color: var(--paper);
  background: var(--surface-dark);
  font-size: 16px;
  line-height: 1.35;
  text-decoration: none;
  box-shadow: inset 0 0 0 0 var(--blue);
  transition: box-shadow 220ms ease, background-color 220ms ease, transform 120ms ease;
}

.page-tile:hover,
.page-tile.is-active {
  background: var(--surface-raised);
  box-shadow: inset 0 0 0 3px var(--blue);
  text-decoration: none;
}

.page-tile:active {
  transform: scale(0.98);
}

.page-tile-chip {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 5px 8px;
  border-radius: 999px;
  color: var(--paper);
  background: rgb(0 0 0 / 68%);
  font-size: 12px;
  font-weight: 700;
}

.page-rows {
  overflow: hidden;
  border-radius: 12px;
  background: var(--wash);
}

.page-row {
  display: grid;
  min-height: 82px;
  align-items: center;
  gap: 12px;
  grid-template-columns: 66px minmax(0, 1fr) auto;
  padding: 10px 14px;
  color: var(--ink);
  text-decoration: none;
  transition: background-color 160ms ease, transform 120ms ease;
}

.page-row + .page-row {
  border-top: 1px solid var(--line);
}

a.page-row:hover {
  background: #e8e8e8;
  text-decoration: none;
}

a.page-row:active {
  background: #dedede;
  transform: scale(0.99);
}

.page-row-meta {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.page-row-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.page-row-copy strong {
  font-size: 17px;
  font-weight: 600;
}

.page-row-copy > span {
  color: var(--muted);
  font-size: 16px;
}

.page-pill {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  color: var(--paper);
  background: var(--blue-pressed);
  font-size: 13px;
  font-weight: 600;
}

.page-callout {
  padding: 26px;
  border: 1px solid #cddff5;
  border-left: 6px solid var(--blue);
  border-radius: 0 12px 12px 0;
  background: #f2f7fd;
}

.page-callout h2 {
  margin-bottom: 14px;
}

.page-callout p:last-child {
  margin-bottom: 0;
}

.page-callout-danger {
  border-color: #f0c5c5;
  border-left-color: var(--danger);
  background: #fff7f7;
}

.page-callout-danger .u-status {
  color: #a61d1d;
}

.page-steps,
.page-checklist {
  display: grid;
  margin: 0;
  padding: 0;
  counter-reset: page-item;
  list-style: none;
}

.page-steps li,
.page-checklist li {
  position: relative;
  display: grid;
  min-height: 88px;
  grid-template-columns: 44px 1fr;
  gap: 14px;
  padding: 16px 0;
  counter-increment: page-item;
}

.page-steps li + li,
.page-checklist li + li {
  border-top: 1px solid var(--line);
}

.page-steps li::before,
.page-checklist li::before {
  display: flex;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--blue);
  border-radius: 50%;
  color: var(--blue-pressed);
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 13px;
  font-weight: 700;
  content: counter(page-item, decimal-leading-zero);
}

.page-checklist li::before {
  border-radius: 8px;
  content: "✓";
}

.page-steps p,
.page-checklist p {
  margin-bottom: 0;
  color: #444;
}

.page-glossary {
  display: grid;
  gap: 4px;
}

.page-glossary > div {
  display: grid;
  gap: 7px;
  padding: 20px;
  border-radius: 8px;
  background: var(--wash);
}

.page-glossary dt {
  font-weight: 700;
}

.page-glossary dd {
  margin: 0;
  color: #3f3f3f;
}

.page-faq details {
  border-top: 1px solid var(--line);
}

.page-faq details:last-child {
  border-bottom: 1px solid var(--line);
}

.page-faq summary {
  min-height: 60px;
  padding: 16px 40px 16px 0;
  cursor: pointer;
  font-weight: 700;
}

.page-faq details p {
  max-width: 66ch;
  padding: 0 0 18px;
}

.page-sources {
  padding: 24px;
  border-radius: 12px;
  color: var(--paper);
  background: var(--surface-dark);
}

.page-sources .u-status {
  color: #bdbdbd;
}

.page-sources h2 {
  font-size: 21px;
}

.page-sources ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.page-sources li,
.page-sources a,
.page-sources span {
  min-height: 44px;
}

.page-sources a,
.page-sources span {
  display: flex;
  align-items: center;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--paper);
  background: var(--surface-raised);
  font-size: 16px;
}

.page-sources a:hover {
  background: #454545;
}

.page-next a {
  display: grid;
  min-height: 82px;
  align-items: center;
  gap: 4px 16px;
  grid-template-columns: 1fr auto;
  padding: 16px 18px;
  border: 2px solid var(--blue-pressed);
  border-radius: 8px;
  color: var(--blue-pressed);
  text-decoration: none;
}

.page-next a:hover {
  color: var(--paper);
  background: var(--blue-pressed);
}

.page-next a span:first-child {
  grid-column: 1;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.page-next a strong {
  grid-column: 1;
  font-size: 18px;
}

.page-next a span:last-child {
  grid-column: 2;
  grid-row: 1 / span 2;
  font-size: 28px;
}

.page-controls {
  position: fixed;
  z-index: 70;
  right: 12px;
  bottom: 12px;
  left: 12px;
  display: grid;
  height: 72px;
  grid-template-columns: repeat(3, 1fr);
  overflow: hidden;
  border: 1px solid #494949;
  border-radius: 16px;
  background: var(--surface-dark);
  box-shadow: var(--shadow);
  transition: transform 250ms ease, opacity 250ms ease;
}

.page-controls a {
  display: flex;
  min-width: 0;
  min-height: 72px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  color: var(--paper);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

.page-controls a + a {
  border-left: 1px solid #494949;
}

.page-controls a:hover {
  background: var(--surface-raised);
}

.page-controls a span:first-child {
  color: #7ab8ff;
  font-size: 20px;
  line-height: 1;
}

.page-footer {
  display: grid;
  gap: 16px;
  padding: 34px 16px 110px;
  color: var(--paper);
  background: var(--ink);
}

.page-footer p {
  max-width: 62ch;
  margin-bottom: 0;
  font-size: 16px;
}

.page-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.page-footer a {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  padding: 8px 12px;
  border: 1px solid #555;
  border-radius: 8px;
  color: var(--paper);
}

.page-error-body {
  display: grid;
  min-height: 100vh;
  grid-template-rows: 1fr auto;
  color: var(--paper);
  background: var(--ink);
}

.page-error {
  display: grid;
  width: min(100% - 32px, 700px);
  align-content: center;
  justify-items: start;
  margin-inline: auto;
  padding: 72px 0;
}

.page-error h1 {
  max-width: none;
}

.page-error p:not(.u-status) {
  color: #dedede;
}

@media (min-width: 720px) {
  .page-card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .page-stage {
    grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  }

  .page-footer {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    padding-inline: clamp(32px, 6vw, 88px);
  }
}

@media (min-width: 1080px) {
  .page-topbar {
    display: none;
  }

  .page-layout {
    display: grid;
    grid-template-columns: 244px minmax(0, 1fr);
  }

  .page-index-desktop {
    position: sticky;
    top: 0;
    display: block;
    height: 100vh;
    overflow: auto;
    padding: 24px 12px;
    border-right: 1px solid var(--line);
    background: var(--wash);
  }

  .page-index-desktop .u-kicker {
    padding: 0 10px;
    color: var(--muted);
  }

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

  .page-index-desktop a:hover,
  .page-index-desktop a[aria-current="page"] {
    color: var(--paper);
  }

  .page-stage {
    min-height: 100vh;
  }

  .page-controls {
    left: calc(244px + 12px);
    width: min(520px, calc(100vw - 280px));
    margin-inline: auto;
  }
}

@media (max-width: 560px) {
  .page-wordmark {
    max-width: 145px;
  }

  .page-stage {
    min-height: calc(100svh - 64px);
    align-content: center;
    padding-inline: 20px;
  }

  .page-route-art {
    width: 76%;
    justify-self: end;
  }

  .page-tile-grid {
    grid-template-columns: 1fr;
  }

  .page-row {
    grid-template-columns: 54px minmax(0, 1fr);
  }

  .page-row .page-pill {
    display: none;
  }

  .page-callout,
  .page-sources {
    padding: 20px;
  }
}

@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .page-controls {
    animation: page-controls-rest 250ms ease 4s both;
  }

  .page-controls:hover,
  .page-controls:focus-within {
    transform: translateY(0);
    opacity: 1;
  }

  @keyframes page-controls-rest {
    to {
      transform: translateY(48px);
      opacity: 0.82;
    }
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
