/* Reading text in the app's Latin face, small and tight; headings and the frame keep Tajawal. */
.section :is(p, li, dd, td),
.reference :is(p, li, dd, td) {
  font-family: var(--lat);
  font-size: 15px;
  line-height: 1.6;
}

/* The opening: what the API is, and beside it what a first call needs. */
.hero {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 28px;
  overflow: hidden;
  padding: 34px 36px 0;
  border-radius: 20px;
  color: #fff;
  background: radial-gradient(
    120% 90% at 100% 0%,
    var(--hero-from) 0%,
    var(--brand-800) 55%,
    var(--hero-to) 100%
  );
}
.hero-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 400px);
  gap: 24px 44px;
  align-items: start;
}
.hero-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 16px;
}
.version {
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.1);
  font: 500 12px/1.5 var(--mono);
  color: var(--on-night-2);
}
.hero h1 {
  font: 500 clamp(25px, 2.5vw, 32px)/1.26 var(--display);
}
.hero .lead {
  max-width: 46em;
  font-size: 15.5px;
  line-height: 1.75;
  color: var(--on-night-2);
}
.base {
  display: flex;
  flex-direction: column;
  border-radius: 14px;
  background: rgba(0, 24, 26, 0.5);
}
.base > div {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 11px 16px 12px;
}
.base > div + div {
  border-top: 1px solid var(--night-hair);
}
.base dt {
  font-size: 12px;
  font-weight: 700;
  line-height: 1.5;
  color: var(--mint);
}
.base dd {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--on-night-2);
}
.base code {
  flex: 1;
  min-width: 0;
  padding: 0;
  background: none;
  box-shadow: none;
  font-size: 13.5px;
  color: #fff;
  overflow-wrap: anywhere;
}
.base .code-copy {
  margin-inline-end: -8px;
}

/* The order's road across the foot of the opening: travelled, the parcel, what is left. */
.road {
  --at: 2;
  position: relative;
  padding-top: 6px;
}
.road-rail {
  position: absolute;
  top: 16px;
  left: 6px;
  right: 6px;
  height: 3px;
}
.road-rest {
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(to right, rgba(255, 255, 255, 0.42) 0 2px, transparent 2px 8px);
}
.road-done {
  position: absolute;
  inset: 0;
  border-radius: 3px;
  background: #fff;
  transform-origin: left center;
  transform: scaleX(calc(var(--at) / 4));
  transition: transform 900ms cubic-bezier(0.23, 1, 0.32, 1);
}
.road-run {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  transform: translateX(calc(var(--at) * 25%));
  transition: transform 900ms cubic-bezier(0.23, 1, 0.32, 1);
}
.road-parcel {
  position: absolute;
  top: -11px;
  left: -12px;
  width: 24px;
  height: 24px;
  filter: drop-shadow(0 4px 6px rgba(0, 20, 22, 0.45));
}
.road-stops {
  position: relative;
  display: flex;
  justify-content: space-between;
  padding: 0 6px;
}
.road-stop {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
  width: 0;
}
.road-stop:first-child .road-code {
  align-self: flex-start;
  margin-inline-start: -6px;
}
.road-stop:last-child .road-code {
  align-self: flex-end;
  margin-inline-end: -6px;
}
.road-dot {
  flex: none;
  width: 11px;
  height: 11px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--brand-800);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.5);
  transition:
    background-color 300ms ease-out,
    box-shadow 300ms ease-out;
}
.road-stop.is-done .road-dot {
  background: #fff;
  box-shadow: none;
}
.road-stop.is-now .road-dot {
  opacity: 0;
}
.road-code {
  font: 400 12px/1.4 var(--mono);
  color: var(--on-night-3);
  white-space: nowrap;
  transition: color 300ms ease-out;
}
.road-stop.is-done .road-code {
  color: var(--on-night-2);
}
.road-stop.is-now .road-code {
  color: #fff;
  font-weight: 500;
}
.hook {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  margin: 0 -36px;
  padding: 12px 36px;
  background: rgba(0, 24, 26, 0.5);
  font-size: 13px;
  color: var(--on-night-2);
}
.hook-label {
  font-weight: 700;
  color: var(--mint);
}
.hook code {
  padding: 0;
  background: none;
  box-shadow: none;
  font-size: 12.5px;
  color: #fff;
}
.hook .hook-status {
  color: var(--parcel-lid);
}

/* Sections */
.section {
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.section-head {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 46em;
}
h2 {
  font-size: 24px;
  font-weight: 800;
  line-height: 1.3;
}
.section-head p {
  color: var(--ink-3);
}
.sub {
  margin-top: 14px;
  font-size: 17px;
  font-weight: 800;
  line-height: 1.4;
}
.prose {
  max-width: 46em;
  color: var(--ink-3);
}
.points {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 46em;
  color: var(--ink-3);
}
.points li {
  position: relative;
  padding-inline-start: 22px;
}
.points li::before {
  content: "";
  position: absolute;
  inset-inline-start: 4px;
  top: 0.72em;
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: var(--brand-300);
  transform: rotate(45deg);
}

/* A heading's own address, shown when the heading is pointed at. */
.anchor {
  margin-inline-start: 8px;
  font: 400 0.8em var(--mono);
  color: var(--faint);
  text-decoration: none;
  opacity: 0;
  transition: opacity 120ms ease-out;
}
:is(h2, h3):hover > .anchor,
.anchor:focus-visible {
  opacity: 1;
}
.anchor:hover {
  color: var(--brand-700);
}
@media (hover: none) {
  .anchor {
    display: none;
  }
}

/* Quickstart */
.steps {
  display: flex;
  flex-direction: column;
}
.step {
  position: relative;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 0 18px;
  padding-bottom: 30px;
}
.step:last-child {
  padding-bottom: 0;
}
.step::before {
  content: "";
  position: absolute;
  top: 36px;
  bottom: 4px;
  left: 14px;
  width: 2px;
  background-image: repeating-linear-gradient(to bottom, var(--rail) 0 6px, transparent 6px 11px);
}
.step:last-child::before {
  display: none;
}
.step-no {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  background: var(--brand-100);
  color: var(--brand-700);
  font: 700 14px/1 var(--lat);
}
.step-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  max-width: 760px;
}
.step h3 {
  font-size: 17px;
  font-weight: 800;
  line-height: 30px;
}
.step p {
  color: var(--ink-3);
}

/* Statuses */
.route {
  border-radius: 16px;
  background: var(--mist);
  box-shadow: inset 0 0 0 1px var(--hair);
}
.route-scroll {
  overflow-x: auto;
  padding: 22px 12px 14px;
}
.route svg {
  display: block;
  width: 100%;
  min-width: 800px;
  height: auto;
}
.route-line {
  fill: none;
  stroke: var(--brand);
  stroke-width: 4;
  stroke-linecap: round;
}
.route-exit path {
  fill: none;
  stroke: var(--faint);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-dasharray: 1 7;
}
.route-stop circle {
  fill: var(--surface);
  stroke: var(--brand);
  stroke-width: 3.5;
}
.route-exit-stop circle {
  fill: var(--surface);
  stroke: var(--quiet);
  stroke-width: 3;
}
.route-exit-stop .is-failed {
  stroke: var(--danger);
}
.route-code text {
  font: 500 13.5px var(--mono);
  fill: var(--ink);
}
.route-gloss text {
  font: 400 13px var(--sans);
  fill: var(--ink-2);
}
.table {
  border-radius: 16px;
  box-shadow: inset 0 0 0 1px var(--edge);
  overflow: hidden;
}
.table table {
  width: 100%;
  border-collapse: collapse;
}
.table th {
  padding: 9px 16px;
  background: var(--mist);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-2);
  text-align: start;
}
.table td {
  padding: 10px 16px;
  border-top: 1px solid var(--hair);
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--ink-3);
  vertical-align: top;
}
.table td:first-child {
  width: 210px;
  font: 500 13.5px/1.9 var(--mono);
  color: var(--ink);
  white-space: nowrap;
}

/* Changelog */
.log {
  display: flex;
  flex-direction: column;
  max-width: 46em;
  border-top: 1px solid var(--hair);
}
.log li {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 4px 20px;
  padding: 14px 0;
  border-bottom: 1px solid var(--hair);
}
.log time {
  font-size: 14px;
  line-height: 1.9;
  color: var(--ink-2);
}
.log p {
  color: var(--ink-3);
}

/* One grid down the page: words in the left column, code in the right rail. */
@media (min-width: 1240px) {
  .section > :not(.steps, .route, .wide) {
    max-width: calc(100% - var(--code-col) - var(--gutter));
  }
  .section.rail {
    display: grid;
    grid-template-columns: minmax(0, 1fr) var(--code-col);
    gap: 0 var(--gutter);
    align-items: start;
  }
  .section.rail > * {
    grid-column: 1;
    max-width: none;
  }
  .section.rail > :not(.code):not(:last-child) {
    margin-bottom: 22px;
  }
  .section.rail > .code {
    grid-column: 2;
    grid-row: 1 / span 20;
    position: sticky;
    top: calc(var(--bar) + 22px);
  }
  .step-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) var(--code-col);
    gap: 0 var(--gutter);
    align-items: start;
    max-width: none;
  }
  .step-body > * {
    grid-column: 1;
  }
  .step-body > :not(.code):not(:last-child) {
    margin-bottom: 12px;
  }
  .step-body > .code {
    grid-column: 2;
    grid-row: 1 / span 20;
  }
}
@media (max-width: 1099px) {
  .hero-top {
    grid-template-columns: minmax(0, 1fr);
  }
  .hero {
    padding: 28px 22px 0;
    border-radius: 18px;
  }
  .hook {
    margin: 0 -22px;
    padding: 12px 22px;
  }
  .table td:first-child {
    width: auto;
  }
}
@media (max-width: 639px) {
  .road-stop:not(.is-now) .road-code {
    visibility: hidden;
  }
  .step {
    gap: 0 12px;
  }
  .table thead {
    display: none;
  }
  .table td {
    display: block;
    padding: 4px 16px 12px;
    border-top: 0;
  }
  .table td:first-child {
    padding: 12px 16px 0;
    border-top: 1px solid var(--hair);
  }
  .log li {
    grid-template-columns: minmax(0, 1fr);
  }
}
