/* The home page: the VPC hero. A fabric map (drawn by
   /assets/js/vpc-map.js) with the headline on top, five notes in the right
   column that highlight parts of the map, and a quickstart terminal with the
   "Start free" cell under them. The hero fills the first screen. */

/* The hero is at least one screen high. The map row takes at least 600px
   and the natural height of the map; on a tall screen it takes the rest. */
.hero {
  display: grid;
  grid-template-rows: minmax(600px, 1fr) auto;
  min-height: calc(100vh - var(--hdr));
}
.hero-m {
  min-height: 0;
}

/* ----- Map stage ----- */
.a-stage {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}
/* The dot grid fades out near the edges of the stage. */
.a-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image: radial-gradient(
    rgba(30, 29, 28, 0.22) 0.7px,
    transparent 0.8px
  );
  background-size: 16px 16px;
  background-position: 8px 8px;
  -webkit-mask:
    linear-gradient(
      90deg,
      transparent,
      #000 64px,
      #000 calc(100% - 64px),
      transparent
    ),
    linear-gradient(transparent, #000 48px, #000 calc(100% - 48px), transparent);
  -webkit-mask-composite: source-in;
  mask:
    linear-gradient(
      90deg,
      transparent,
      #000 64px,
      #000 calc(100% - 64px),
      transparent
    ),
    linear-gradient(transparent, #000 48px, #000 calc(100% - 48px), transparent);
  mask-composite: intersect;
}
.a-tag {
  position: relative;
  z-index: 2;
  flex: none;
  padding: 28px 32px 8px;
}
.a-tag h1 {
  margin: 0;
  max-width: 620px;
  font: 500 38px / 1.06 var(--font-display);
  letter-spacing: -0.022em;
  text-wrap: balance;
}
.a-stage svg {
  display: block;
  flex: 1;
  width: 100%;
  min-height: 0;
  overflow: visible;
}
.a-hud {
  position: absolute;
  bottom: 14px;
  left: var(--pad);
  right: 16px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font: 11px var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  pointer-events: none;
}
.a-hud .clock {
  color: var(--apx-ink);
}
.a-tip {
  position: absolute;
  z-index: 5;
  min-width: 210px;
  padding: 10px 12px;
  background: var(--apx-ink);
  color: var(--apx-bone);
  font: 11px / 1.6 var(--font-mono);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s;
}
.a-tip.on {
  opacity: 1;
}
.a-tip .r {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}
.a-tip .r span:first-child {
  color: var(--apx-stone);
}
.a-tip .n {
  margin-bottom: 6px;
  font-size: 12px;
}

/* ----- What each note highlights on the map -----
   With no note picked, the boundaries and the ingress and egress flows are
   hidden. A picked note sets data-hl on the svg: the layers of that note stay
   at full opacity and the other layers go faint. */
#vpc-map .node {
  cursor: pointer;
}
#vpc-map .node:hover rect.box {
  stroke-width: 2;
}
#vpc-map [data-vpc] {
  transition: opacity 0.25s;
}
#vpc-map svg :is(.bb, .dl, .pp, .pr, .pkp, .pkr, .rl) {
  transition: opacity 0.3s;
}
#vpc-map :is(.ing, .egr, .vb) {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s;
}
#vpc-map svg[data-hl] :is(.bb, .dl, .pp, .pr, .pkp, .pkr, .rl) {
  opacity: 0.12;
}
#vpc-map svg[data-hl="relay"] :is(.bb, .dl, .rl),
#vpc-map svg[data-hl="p2p"] :is(.pp, .pkp),
#vpc-map svg[data-hl="vpc"] :is(.dl, .pp, .pr, .pkp, .pkr),
#vpc-map svg[data-hl="vpc"] .vb,
#vpc-map svg[data-hl="in"] .ing,
#vpc-map svg[data-hl="in"] .rl[data-id="sfo"],
#vpc-map svg[data-hl="out"] .egr,
#vpc-map svg[data-hl="out"] .rl[data-id="fra"] {
  opacity: 1;
}
#vpc-map svg[data-hl="vpc"] :is(.bb, .rl) {
  opacity: 0.3;
}
#vpc-map svg[data-hl="in"] .node:not([data-id="run"]),
#vpc-map svg[data-hl="out"] .node:not([data-id="gce"]) {
  opacity: 0.2;
}

/* ----- Notes ----- */
.b-side {
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.b-notes {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-rows: repeat(5, auto) minmax(0, 1fr) auto;
  overflow: hidden;
}
.b-note {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  column-gap: 18px;
  align-items: center;
  min-height: 0;
  overflow: hidden;
  padding: 18px var(--pad) 18px 18px;
  border: 0;
  border-bottom: 1px solid var(--hair);
  background: transparent;
  text-align: left;
  transition: background 0.15s;
}
.b-note:hover {
  background: var(--apx-mist);
}
.b-note.on {
  background: var(--apx-paper);
}
.b-note .n {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--apx-ink);
  color: var(--apx-bone);
  line-height: 0;
}
.b-note:hover .n {
  background: #2a2826;
}
.b-note.on .n,
.b-note.on:hover .n {
  background: var(--apx-blue);
  color: #fff;
}
.b-note .n svg {
  display: block;
  width: 12px;
  height: 12px;
}
.b-note > span:last-child {
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.b-note b {
  display: block;
  margin-bottom: 2px;
  font: 500 13px var(--font-body);
}
.b-note .d {
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--text-secondary);
}
.b-ma {
  display: flex;
  align-items: flex-end;
  padding: 0 var(--pad) 22px 24px;
  font: 11px var(--font-mono);
  letter-spacing: 0.06em;
  color: var(--text-muted);
}
@media (max-height: 860px) {
  .b-note .d {
    font-size: 12px;
  }
}
@media (max-height: 760px) and (min-width: 961px) {
  .b-note .d {
    display: none;
  }
}

/* ----- Quickstart terminal ----- */
.a-term {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--apx-paper);
}
.a-th {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: stretch;
  padding-left: var(--pad);
  border-bottom: 1px solid var(--hair);
  font: 500 10px var(--font-mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.a-th > .k {
  display: flex;
  align-items: center;
  padding-right: 20px;
}
.a-th > a {
  display: flex;
  align-items: center;
  padding: 0 var(--pad);
  border-left: 1px solid var(--hair);
  color: var(--apx-ink);
  letter-spacing: 0.08em;
  white-space: nowrap;
}
.a-th > a:hover {
  color: var(--apx-blue-deep);
}
.a-tabs {
  display: flex;
  border-left: 1px solid var(--hair);
}
.a-tabs button {
  position: relative;
  padding: 10px 18px;
  border: 0;
  border-right: 1px solid var(--hair);
  background: none;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  color: var(--text-muted);
}
.a-tabs button:hover {
  color: var(--apx-ink);
  background: var(--apx-mist);
}
.a-tabs button[aria-selected="true"] {
  color: var(--apx-ink);
  background: var(--apx-bone);
}
.a-tabs button[aria-selected="true"]::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: var(--apx-ink);
}
/* Five lines of 12.5px/1.7 text, the row spacing, and the padding. */
.a-tl {
  display: flex;
  flex-direction: column;
  gap: 2px;
  height: calc(12.5px * 1.7 * 5 + 2px * 4 + 6px * 2 + 26px);
  overflow: hidden;
  padding: 12px var(--pad) 14px;
  font: 12.5px / 1.7 var(--font-mono);
  font-variant-ligatures: none;
}
.a-ln {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--apx-ink);
  font: inherit;
  text-align: left;
}
.a-ln code {
  overflow: hidden;
  font: inherit;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.a-ln code i {
  margin-right: 10px;
  font-style: normal;
  color: var(--text-muted);
}
.a-ln:hover code {
  color: var(--apx-blue-deep);
}
.a-ln .cp {
  flex: none;
  font: 500 10px var(--font-mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  opacity: 0;
  transition: opacity var(--d-fast);
}
.a-ln.done .cp,
.a-ln.ok .cp {
  opacity: 1;
}
.a-ln:hover .cp {
  color: var(--apx-ink);
}
.a-ln.ok .cp {
  color: var(--apx-blue-deep);
}
.a-ln .cur {
  display: inline-block;
  width: 0.6em;
  height: 1.05em;
  margin-left: 1px;
  vertical-align: -0.18em;
  background: var(--apx-ink);
  animation: blk 1s steps(1) infinite;
}
@keyframes blk {
  50% {
    opacity: 0;
  }
}
.a-o {
  overflow: hidden;
  margin-bottom: 6px;
  padding-left: 22px;
  color: var(--text-secondary);
  white-space: nowrap;
  text-overflow: ellipsis;
}
.a-o:last-child {
  margin-bottom: 0;
}
.a-o b {
  font-weight: 500;
  color: #3e8a4a;
}
.hero-b .a-go {
  min-height: 0;
  padding: 20px var(--pad);
}

@media (max-width: 1280px) {
  .a-tag h1 {
    font-size: 30px;
  }
  .a-th {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }
}
@media (prefers-reduced-motion: reduce) {
  .a-ln .cur {
    animation: none;
  }
}

/* Below 960px the notes go under the map, and the map keeps its shape. */
@media (max-width: 960px) {
  .hero {
    grid-template-rows: auto auto;
    min-height: 0;
  }
  .hero-m,
  .hero-b {
    grid-template-columns: minmax(0, 1fr);
  }
  .hero-m > .sd,
  .hero-b > .sd {
    border-left: 0;
    border-top: 1px solid var(--apx-ink);
  }
  .a-stage svg {
    flex: none;
    height: auto;
    aspect-ratio: 1040 / 565;
  }
  /* The caption goes under the map, as on a wide screen. */
  .a-hud {
    position: static;
    order: 1;
    padding: 8px var(--pad) 14px;
  }
  .b-notes {
    grid-template-rows: none;
  }
  .b-ma:empty {
    display: none;
  }
  .b-ma {
    padding: 14px var(--pad) 16px;
  }
  .hero-b .a-go {
    min-height: 140px;
  }
}
@media (max-width: 720px) {
  .a-tag {
    padding: 24px var(--pad) 8px;
  }
  .a-tag h1 {
    font-size: 30px;
  }
  .b-note {
    padding: 16px var(--pad);
  }
  .a-th {
    grid-template-columns: minmax(0, 1fr) auto;
    padding-left: 0;
  }
  .a-th > .k {
    display: none;
  }
  .a-tabs {
    border-left: 0;
  }
  .a-tabs button {
    padding: 12px var(--pad);
  }
  .a-tabs button + button {
    padding: 12px 18px;
  }
}
