/* The home page: the VPC hero. A fabric map (drawn by
   /assets/js/vpc-map.js) with the headline, the problem, the next steps and a
   customer story on top, five notes that highlight parts of the map, and a
   quickstart terminal with the "Request access" cell under them. The hero
   fills the first screen.

   Wide screens: the notes are the right column. At 960px and below the notes
   become a row of tabs right under the map, and the text of the selected tab
   shows under them. At 720px and below the hero has a phone layout (at the
   end of this file) and the map has its own small layout. */

/* 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;
}
/* A jump to /#vpc stops under the sticky top bar. */
.hero {
  scroll-margin-top: var(--hdr);
}

/* ----- 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(var(--dot) 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;
}

/* ----- Headline, problem, next steps ----- */
/* Wide screens: the headline and the problem on the left, the two links
   and the customer story on the right. */
.a-tag {
  position: relative;
  z-index: 2;
  flex: none;
  display: grid;
  grid-template-columns: minmax(0, 640px) minmax(240px, 320px);
  justify-content: space-between;
  align-items: start;
  column-gap: 40px;
  row-gap: 12px;
  padding: 28px 32px 8px;
}
.a-tag h1 {
  grid-column: 1;
  margin: 0;
  max-width: 620px;
  font: 500 38px / 1.06 var(--font-display);
  letter-spacing: -0.022em;
  text-wrap: balance;
}
.a-lede {
  grid-column: 1;
  max-width: 58ch;
  margin: 0;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text-secondary);
  text-wrap: pretty;
}
.a-act {
  grid-column: 2;
  grid-row: 1 / span 2;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-top: 6px;
}
.a-proof {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-secondary);
}
.a-proof a .u {
  white-space: nowrap;
  color: var(--apx-ink);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.a-proof a:hover .u {
  color: var(--apx-blue-deep);
}

/* The map panel box is for the phone layout only. */
.a-map {
  display: contents;
}
.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;
  max-width: calc(100% - 16px);
  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;
}

/* ----- The map colors -----
   vpc-map.js sets the fill and stroke of each shape to one of these, so the
   map follows the theme. */
#vpc-map {
  --map-ink: var(--apx-ink);
  --map-bone: var(--apx-bone);
  --map-slate: var(--apx-slate);
  --map-blue: var(--apx-blue);
  --map-blue-deep: var(--apx-blue-deep);
  --map-fog: var(--apx-fog);
  --map-amber: var(--apx-amber);
}

/* ----- 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. The relay and the endpoint
   of the ingress flow have the class f-in, and those of the egress flow
   f-out. */
#vpc-map .node {
  cursor: pointer;
  outline: none;
}
#vpc-map .node:hover rect.box,
#vpc-map .node[aria-expanded="true"] rect.box {
  stroke-width: 2;
}
/* The script sets the stroke in the style attribute, so this needs
   !important. */
#vpc-map .node:focus-visible rect.box {
  stroke: var(--apx-blue) !important;
  stroke-width: 3;
}
/* The phone map has thinner lines (the stroke scale in vpc-map.js). */
#vpc-map svg[data-layout="narrow"] .node:hover rect.box,
#vpc-map svg[data-layout="narrow"] .node[aria-expanded="true"] rect.box {
  stroke-width: 1.4;
}
#vpc-map svg[data-layout="narrow"] .node:focus-visible 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.f-in,
#vpc-map svg[data-hl="out"] .egr,
#vpc-map svg[data-hl="out"] .rl.f-out {
  opacity: 1;
}
#vpc-map svg[data-hl="vpc"] :is(.bb, .rl) {
  opacity: 0.3;
}
#vpc-map svg[data-hl="in"] .node:not(.f-in),
#vpc-map svg[data-hl="out"] .node:not(.f-out) {
  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: var(--ink-hover);
}
.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;
  margin: 0;
  padding: 0 var(--pad) 22px 24px;
  font: 11px var(--font-mono);
  letter-spacing: 0.06em;
  color: var(--text-muted);
}
.b-cap :is(.desc, .hint-m, .cg) {
  display: none;
}
/* The copy of the customer story for the phone layout. */
.a-proof-m {
  display: none;
}
@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;
  min-height: 36px;
  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);
}
/* The live lines and a hidden copy of the full tab are in one grid cell. The
   copy keeps the height of the finished tab, so typing does not move the
   page. */
.a-tl {
  display: grid;
  padding: 12px var(--pad) 14px;
  font: 12.5px / 1.7 var(--font-mono);
  font-variant-ligatures: none;
}
.a-tl > * {
  grid-area: 1 / 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.a-tl-g {
  visibility: hidden;
}
.a-ln {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--apx-ink);
  font: inherit;
  text-align: left;
}
/* Commands wrap; nothing is cut off. */
.a-ln code {
  min-width: 0;
  font: inherit;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.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;
  padding-top: 3px;
  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 {
  margin-bottom: 6px;
  padding-left: 22px;
  color: var(--text-secondary);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.a-o:last-child {
  margin-bottom: 0;
}
.a-o b {
  font-weight: 500;
  color: var(--ok);
}
.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 become tabs 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-tag {
    grid-template-columns: minmax(0, 1fr);
    padding-bottom: 20px;
  }
  .a-act {
    grid-column: 1;
    grid-row: auto;
    padding-top: 4px;
  }
  .a-stage svg {
    flex: none;
    height: auto;
    aspect-ratio: 1040 / 565;
  }
  /* The map needs room under it for the caption. */
  .a-stage {
    padding-bottom: 36px;
  }

  /* The tabs: one row, an icon over a short name. The text of the selected
     tab shows in the caption under the row. */
  .b-notes {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    grid-template-rows: auto auto;
  }
  .b-note {
    grid-template-columns: minmax(0, 1fr);
    justify-items: center;
    align-content: start;
    row-gap: 8px;
    min-height: 72px;
    padding: 12px 4px 10px;
    border-bottom: 1px solid var(--hair);
    border-left: 1px solid var(--hair);
    text-align: center;
  }
  .b-note:first-child {
    border-left: 0;
  }
  .b-note.on {
    background: var(--apx-paper);
    box-shadow: inset 0 3px 0 var(--apx-ink);
  }
  .b-note > span:last-child {
    align-items: center;
  }
  .b-note b {
    margin: 0;
    font-size: 12px;
    line-height: 1.25;
  }
  .b-note .d {
    display: none;
  }
  .b-ma:empty {
    display: none;
  }
  /* The caption texts and their hidden copies (.cg) share one grid cell, so
     the cell has the height of the longest text. */
  .b-cap {
    grid-column: 1 / -1;
    display: grid;
    align-items: start;
    padding: 14px var(--pad) 16px;
    font: 14px / 1.5 var(--font-body);
    letter-spacing: 0;
    color: var(--text-secondary);
  }
  .b-cap .hint {
    font: 11px / 1.6 var(--font-mono);
    letter-spacing: 0.06em;
    color: var(--text-muted);
  }
  .b-cap.sel .hint {
    display: none;
  }
  .b-cap > * {
    grid-area: 1 / 1;
  }
  .b-cap .cg {
    display: block;
    visibility: hidden;
  }
  .b-cap.sel .desc {
    display: block;
  }
  .b-cap .desc b {
    font-weight: 500;
    color: var(--apx-ink);
  }
  .hero-b .a-go {
    min-height: 140px;
  }
  /* Bigger copy targets for touch. */
  .a-ln.done,
  .a-ln.ok {
    min-height: 44px;
    align-items: center;
  }
  .a-ln .cp {
    padding: 6px 10px;
    border: 1px solid var(--hair);
  }
  .a-tabs button {
    min-height: 44px;
  }
}
/* ----- Phone layout, at 720px and below -----
   From top to bottom: the headline with the problem and the two links, the
   map panel, the five tabs and their caption, the customer story, the
   "Request access" cell, and the quickstart. The tabs drive the map. The
   figure label and the clock are not shown. */
@media (max-width: 720px) {
  /* A node tip that does not fit in the map panel goes over the parts
     next to it, so nothing here clips it. */
  .a-stage {
    padding-bottom: 0;
    overflow: visible;
  }
  .a-stage::before {
    display: none;
  }
  .a-tag {
    row-gap: 0;
    padding: 28px var(--pad) 22px;
  }
  .a-tag h1 {
    max-width: none;
    font-size: 40px;
    line-height: 0.98;
    letter-spacing: -0.03em;
  }
  .a-lede {
    margin-top: 14px;
  }
  /* On a phone the customer story goes under the map (.a-proof-m). */
  .a-act {
    display: none;
  }

  /* The map panel. The dot grid fades out near its edges. */
  .a-map {
    position: relative;
    z-index: 3;
    isolation: isolate;
    display: block;
    border-top: 1px solid var(--apx-ink);
  }
  .a-map::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background-image: radial-gradient(var(--dot) 0.7px, transparent 0.8px);
    background-size: 16px 16px;
    background-position: 8px 8px;
    -webkit-mask:
      linear-gradient(
        90deg,
        transparent,
        #000 32px,
        #000 calc(100% - 32px),
        transparent
      ),
      linear-gradient(
        transparent,
        #000 48px,
        #000 calc(100% - 48px),
        transparent
      );
    -webkit-mask-composite: source-in;
    mask:
      linear-gradient(
        90deg,
        transparent,
        #000 32px,
        #000 calc(100% - 32px),
        transparent
      ),
      linear-gradient(
        transparent,
        #000 48px,
        #000 calc(100% - 48px),
        transparent
      );
    mask-composite: intersect;
  }
  .a-hud {
    display: none;
  }
  /* The svg takes the shape of its viewBox. vpc-map.js sets the viewBox. */
  .a-stage svg[data-layout="narrow"] {
    max-width: 480px;
    margin: 0 auto;
    padding: 4px 8px 12px;
    aspect-ratio: auto;
  }

  /* The tabs: a round icon over a short mono name. A pulse on the icon shows
     the next tab to try. */
  .b-note {
    min-height: 84px;
    padding: 14px 4px 12px;
  }
  .b-note.on {
    box-shadow: none;
  }
  .b-note .n {
    width: 30px;
    height: 30px;
  }
  .b-note .n svg {
    width: 13px;
    height: 13px;
  }
  .b-note b {
    font: 500 9.5px / 1.3 var(--font-mono);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-secondary);
  }
  .b-note.on b {
    color: var(--apx-ink);
  }
  .b-note.next .n {
    animation: note-next 1.4s ease-in-out infinite;
  }
  @keyframes note-next {
    0%,
    100% {
      box-shadow: 0 0 0 0 rgba(61, 145, 220, 0.5);
    }
    50% {
      box-shadow: 0 0 0 5px rgba(61, 145, 220, 0);
    }
  }
  .b-cap .hint {
    display: none;
  }
  .b-cap .hint-m {
    display: inline;
  }
  .b-cap.sel .hint-m {
    display: none;
  }

  /* The customer story and the "Request access" cell in one row, then the
     quickstart. */
  .rw.hero-b {
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  }
  .a-proof-m {
    order: -2;
    display: flex;
    padding: 18px var(--pad) 20px;
  }
  .hero-b .a-go {
    order: -1;
    min-height: 0;
    padding: 16px var(--pad) 18px;
    border-top: 0;
  }
  .hero-b .a-go .k {
    flex-direction: column;
    gap: 2px;
  }
  .hero-b .a-go .row {
    gap: 8px;
    margin-top: 16px;
  }
  .hero-b .a-go .v {
    font-size: 24px;
    line-height: 1.05;
  }
  .hero-b .a-go .ar {
    font-size: 22px;
  }
  .a-term {
    grid-column: 1 / -1;
    border-top: 1px solid var(--apx-ink);
  }
  .a-th {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }
  .a-th > .k {
    padding-right: 14px;
  }
  .a-tabs button {
    padding: 0 14px;
    letter-spacing: 0.12em;
  }
  .a-th .lg {
    display: none;
  }
  .a-tl {
    padding: 12px var(--pad) 14px;
    font-size: 12px;
  }
  .a-ln .cp {
    padding: 0;
    border: 0;
  }
}
@media (max-width: 720px) and (prefers-reduced-motion: reduce) {
  .b-note.next .n {
    animation: none;
  }
}
@media (max-width: 360px) {
  .a-tag h1 {
    font-size: 34px;
  }
  .rw.hero-b {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  }
  .hero-b .a-go {
    padding-left: 14px;
    padding-right: 14px;
  }
  .hero-b .a-go .v {
    font-size: 22px;
  }
  .b-note {
    padding-left: 2px;
    padding-right: 2px;
  }
  /* There is no room for the docs link. The menu has it. */
  .a-th > a {
    display: none;
  }
}
